Execute the monthly backup script the 1st of every month at 12:45 AM.Execute the weekly backup script every Monday at 12:30 AM.Execute the daily backup script everyday at 12:15 AM.In case you’re not familiar with cron syntax, this is what we’re doing: 15 0 * * * sh /home/tony/backup-daily.shģ0 0 * * 1 sh /home/tony/backup-weekly.shĤ5 0 1 * * sh /home/tony/backup-monthly.sh Open the cron editor with the crontab -e command and add the following while specifying the actual full path to your script files. You can create a cronjob to call the daily, weekly, and monthly backup scripts. The following tar command will create a compressed archive of the /var/tar -zcf /home/tony/backup/monthly/backup-$(date +%Y%m%d).tar.gz -C /var/ The following tar command will create a compressed archive of the /var/tar -zcf /home/tony/backup/weekly/backup-$(date +%Y%m%d).tar.gz -C /var/ The following tar command will create a compressed archive of the /var/tar -zcf /home/tony/backup/daily/backup-$(date +%Y%m%d).tar.gz -C /var/ To do this, we will use the tar, find, and rsync commands as well as cron to automate the task. In this tutorial, you will learn how to create daily, weekly, and monthly backups on Ubuntu/Debian with a script.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |