Quantcast
Channel: Export crontab to a file - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Michelle for Export crontab to a file

$
0
0

To add some more cool commands for backuping and restoring crontab. Might be useful.

Backup periodically current cron with cron :)

0 9 * * * crontab -l | gzip > /backups/'crontab-'$(date +"\%Y\%m\%d-\%H\%M\%S")'.gz'

Restore Single User Cronjobs from Backup. Below is two commands which will restored jobs from backup created in above step.

crontab cron-backup.txtcrontab -u john john-cron-backup.txt

Backup all users crontabs

zip -r cronjobs-all.zip /var/spool/cron

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>