Backup with CRON

Below is the code added to 192.168.254.246 to back up all the files in the /var/www/marketing/ directory,. It is set to run every day at 1am and saves a zip file with the current date into the /backup directory:

* 1 * * * cd /backup && zip -r "$(date +"%Y%m%d")-live.zip" /var/www/marketing/

This command has been added using crontab -e (vim commands needed here).

After making changes, be sure to run this to restart cron:

service crond restart

The command below can show you what jobs are currently running:

crontab -l

The command below will delete all cron jobs:

crontab -r

Leave a Reply

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