Forum Discussion
Crontab for backups - Entries not running
Trying to configure a cron-based daily backup for a vCMP guest, running v13.1.1. As root, using crontab -e, I've added the following lines:
27 8 * * * /usr/bin/tmsh save sys ucs config1.ucs
29 8 * * * /usr/bin/scp /var/local/ucs/config1.ucs user@server:/backups/config1.ucs
After exiting, I've verified the changes have saved. Logs reflect that a change has been made. These jobs never happen based on the timestamp of the backup not changing, nor is either job recorded in the logs. I can manually run the same command, and they work successfully. Any help is appreciated.
Solution Information: The jobs were running, but not at specified times. The root cause was that the guest had not been restarted since the time zone was set, and cron was using the previous time zone. See K14113 for the details on how to restart the cron daemon.
- Chuck_383680Cirrus
Solution Information: The jobs were running, but not at specified times. The root cause was that the guest had not been restarted since the time zone was set, and cron was using the previous time zone. See K14113 for the details on how to restart the cron daemon.
- Chuck_383680Cirrus
Thanks. I'm still getting used to this. And, thanks again for the help!
- Dylan_375544Cirrocumulus
What I meant was to select an answer, like my original answer post. Once you select it as the "user selected answer" it shows as "answered" on the main page.
(:
- Dylan_375544Cirrocumulus
Ahhhh glad you got to the bottom of it! I was planning on mentioning this morning to look in to time settings/zones more.
Thanks for sharing the solution.
If you don't mind selecting an answer so people browsing DevCentral know this issue is solved, it would be greatly appreciated!
Have a good one Chuck!
- Chuck_383680Cirrus
SOLVED!
I had not restarted this guest since it was built. See K14113 for the details.
Thank you Dylan and jaikumar for your help.
- Chuck_383680Cirrus
Also, hardware clock is reflecting UTC:
[root@DEV1:Active:In Sync] ucs hwclock
- Chuck_383680Cirrus
I'm still looking into this, but the cron job did run, just not at the desired time. I'm going to go back through the configs because this does look like a timezone setting issue, just not the normal use of UTC. Here are the details:
From Crontab:
29 15 * * * /root/backup.sh
Timestamp from file:
-rw-r--r--. 1 root root 3.5M 2019-02-13 17:29 config-dev1.ucs
Time Information from Guest:
[root@DEV1:Active:In Sync] ucs date
Thu Feb 14 08:22:44 CST 2019
Time Server Sync Information:
[root@DEV1:Active:In Sync] ucs ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*TIME1 129.6.15.28 2 u 962 1024 377 0.335 0.048 0.708
+TIME2 129.6.15.28 2 u 73 1024 377 0.346 -0.005 0.102
Hey Chuck!
Just as a side note, have you checked out this iApp for backups? I'm using it in multiple environments and it is working great, even on version 13.1.1.2. It will fix all of the cron jobs and you access it from the WebGUI.
It will let you define how often the backup runs and also enter the credentials to the remote storage. It will send over the UCS archives and it will automatically rotate (delete old ones) up to 10 files. I'm sure this can be modified if you want. I think it works great. :)
You can find it here:
I hope this helps!
@Chuck,
- Here 4 is the minute & 15 is the hour.4 15 * * *
So everyday, at 03:04 PM (box timezone), the cron will get executed. See what your box timezone is. And put your cron accordingly.
- Dylan_375544Cirrocumulus
I did
23 13 * * * tmsh save sys ucs thisisatest2.ucs
so it would create one a 1:23 and that just worked.
(Still on 13.1.1.3)
Check the time on your device maybe?
- Chuck_383680Cirrus
You are defiantly onto something. I swapped mine to using */5 * * * * and that worked. When I changed it back to 4 15 * * *, it no longer works. Does a specific time work for you?
- Dylan_375544Cirrocumulus
I just tested this on v 13.1.1.3.
All I did was add:
to the crontab file.*/1 * * * * tmsh save sys ucs thisisatest.ucs
(The */1 * * * * just runs it every minute)
and I have a fresh ucs created.
You are running rontab -e and then doing "Esc:wq" then enter to quit editing correct?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com