Goal: copy files in the source folder to a destination folder with date mark (such as 20110131) as sub folder name. Run the backup every 10 days.

1. Csh command: cp -a <source> <dest>`date +%Y%m%d`

cp -a /site.com/public_html/include/content  /site.com/content_backup/`date +%Y%m%d` 2>/site.com/content_backup/errors.txt


2. edit your crontab file using crontab -e

(reference: http://adminschoice.com/crontab-quick-reference)

0   20   *  10 1-5 – 8.00 PM every weekday (Mon-Fri) only in Oct.

0 0 1,10,15 * * – midnight on 1st ,10th & 15th of month

0      20  1, 10, 20      *   *  /site.com/content_backup/backupScript

Automatic backup a folder on Apache server
Tagged on:                     

Leave a Reply

Your email address will not be published. Required fields are marked *