系统中比较重要的目录有/etc,/home,/var/spool/mail等,每天2:45进行备份,备份数据存到/backup中,并用tar将备份数据打包
#mkdir /root/bin; vim /root/bin/backup.sh
#!/bin/bash
backdir="/etc /home /root /var//spool/mail"
basedir=/backup
[! -d "$basedir"] && mkdir $basedir
backfile=$basedir/backup.tar.gz
tar -zcvf $backfile $backdir
#vim /etc/crontab
45 2 * * * root sh /root/bin/backup.sh