cron jobs

crontab -l – view crontab entries
crontab -e – edit crontab entries
crontab -r – delete cronjobs
crontab -ir – confirmation before removing all the crontab entries

M H D M DOW
30 08 10 06 * /home/ramesh/full-backup – take a full backup on 10th June 08:30 AM
30 – Minute
08 – 08 AM
10 – 10th Day
06 – 6th Month (June)
* – Every day of the week

00 11,16 * * * /home/ramesh/bin/incremental-backup – take a incremental backup twice a day every day
00 – 0th Minute (Top of the hour)
11,16 – 11 AM and 4 PM
* – Every day
* – Every month
* – Every day of the week

Daily Backups of website and database

1. Create a backup dir on the server.
2. Create separate dir for each domain
3. Create a mysql dir in each domain dir

crontab -e -show all the current crons
vi crontab -e – edit the current cron jobs

30 3 * * * /bin/tar -czf /backup/simatel.co.uk/simatel.co.uk- `date +\%m\%d\%y`.tar.gz /var/www/vhosts/simatel.co.uk – Backups the website simatel.co.uk every night at 03:30

0 4 * * * /usr/bin/mysqldump < wordpress_b -u wordpress_b -p Hhk9- *#F | /bin/gzip > /backup/simatel.co.uk/mysql/mysql–`date +\%m\%d\%y`.sql.gz – Backups the database wordpress_b every night at 04:00