Forum Discussion

ashu_aggarwal1's avatar
ashu_aggarwal1
Icon for Altocumulus rankAltocumulus
Nov 29, 2022

F5 OS r-Series cron job schedule

Hello All,

I am looking for some assistence to schedule a cron job on the F5 OS host for taking regular backup for the F5 host system and exporting it to the remote path.

I am trying to execute commands from bash terminal however it doesnt seems to be working.

Is there a way we can run commands using admin username to get the output from the F5 OS.

[root@appliance-1(hostname) ~]# su - admin -c show system
Invalid command

 

 

 

6 Replies

  • Hello Ashu, wanted to know have you achieved this in F5OS? could you please share on how you are doing this in current set? 

  • Hi Ashu,

     

    It sounds like you're trying to schedule a cron job on an F5 OS r-Series system to automate backups and export them to a remote path.

    Here are some simple steps and tips to help you achieve this:

    1. Cron Job Setup:
      • First, ensure you have the correct syntax for your cron job. You can edit the crontab file using crontab -e and add your cron job there. For example, to run a script every day at midnight, you would add:
      0 0 * * * /path/to/your/backup_script.sh
    2. Backup Script:
      • Create a script that performs the backup and exports it. Here’s a simple example:
      #!/bin/bash # Backup F5 configuration tmsh save /sys ucs /var/local/ucs/backup.ucs # Export to remote path scp /var/local/ucs/backup.ucs user@remote_host:/remote/path/
    3. Running Commands as Admin:
      • It seems like you're having trouble running commands as the admin user. Instead of using su - admin -c, you might need to log in as the admin user directly or use a different method to execute commands with the necessary permissions. For example, you can use the RESTCONF API for such tasks as told above by Nikoolayy [1].
    4. Troubleshooting:
      • If your cron job isn’t working, try running the script manually to ensure it executes properly. Also, check the cron logs for any errors:
      grep CRON /var/log/syslog
    5. Permissions:
      • Ensure that the script has the correct permissions to be executed. You can set the executable permission using: bash chmod +x /path/to/your/backup_script.sh

    If you continue to face issues, you might want to explore using the RESTCONF API for automating tasks on the F5 OS r-Series[1][2].

     


    References

    [1] F5 OS r-Series cron job schedule | DevCentral

    [2] Automate Tasks in F5 with Cron Jobs - NetMinion Solutions

  • F5 seems to have added a cool new article Enabling automatic periodic backups on rSeries . F5OS cronjob something I think F5 is pushing away from being used as it was with tmos BIG-IP even when using the "root" account that has access to the Linux bash F5OS root user and bash access are local-only. Also even on normal BIG-IP I use icall as after upgrade the cronjobs are removed while icall stays but there seems to be no icall on F5OS at the moment, so I recommend following the F5 article.