July 8, 2016

Scheduling daily backup job using crontab

1. cd /etc/cron.daily
2. Create a symbolic link to the job
ln -s /home/auser/mysqlbackups/db_to_s3_backup.sh db_backup

This will make it run at 4.02am daily per crontab definition

> cat /etc/crontab
...
.....
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
~
...


Crontab format. Ref: https://www.pantz.org/software/cron/croninfo.html
# Minute   Hour   Day of Month       Month          Day of Week        Command    
# (0-59)  (0-23)     (1-31)    (1-12 or Jan-Dec)  (0-6 or Sun-Sat)                
    0        2          12             *                *            /usr/bin/find

No comments:

Post a Comment