Auto Backup Crontab User root Every Weeks time 04:00 a.m.
May-22-2015 By admin
TAG: Auto Backup Crontab User root Every Weeks time 04:00 a.m.
#Create Folder For Backup
mkdir /root/backup/
#Create Folder For Shell Scripts
mkdir /root/scripts/
#Create Shell Scripts File
vi /root/scripts/backup-crontab.sh
#!/bin/bash
crontab -l -u root > /root/backup/crontab-`date +%Y-%m-%d`
:wq! Save and Quit
#Chmod Permission file for Shell Scripts Allow User root – Read+Write+Execute
chmod 700 /root/scripts/backup-crontab.sh
#Add Shell Scripts Run Every Weeks time 04:00 a.m. on crontab
crontab -e
input line below :
#backup crontab every weeks
0 4 * * 0 /bin/sh /root/scripts/backup-crontab.sh
:wq! = save and quit
Success!!!!
Posted in: Linux Shell Scripts