Yesterday I setup a rotating backup for my wordpress sites that I am self hosting on an ubuntu server.
Had to update the system time on my server to make sure my cron jobs actually execute when I expect them to. I ran the following commands:
sudo timedatectl set-timezone America/Los_Angeles
sudo hwclock –systohc
sudo timedatectl set-ntp true
sudo systemctl restart cron
sudo systemctl restart rsyslog
this updated the cron daemon and the syslog daemon to use the new timesettings, which I set to Los Angeles time, and also made sure they are synced with an NTP server.
I also edit the logging system configuration by running
vi /etc/rsyslog.d/50-default.conf
Then uncommenting the line
cron.* /var/log/cron.log
This allows me to follow the tail of the log file and make sure that my cron job is executed at the expected time without any errors
tail -f /var/log/cron.log