linux freebsd通用备份脚本
#!/bin/sh
backupdir=”/home/data/backup/”
if [ ! -d $backupdir ];then
mkdir $backupdir
fi
# mkdir today backup
today=`date +%Y-%m-%d_%H_%M_%S`
fpath=$backupdir$today
echo $fpath
if [ ! -d $fpath ];then
mkdir $fpath
fi
# delete old file
find $backupdir -type f -mtime +7 -print -exec /bin/rm -f {} \;
FL=`cat /home/data/file_list`
for i in $FL ;do
cp -Rp $i $fpath
done
# backup my self
cp -Rp $0 $fpath
cp -Rp /home/data/file_list $fpath
cd $backupdir
tar czf $today.tar.gz $today
rm -rf $today
cd –
# ftp …
ftp -n<<!
open 61.00.00.00
user ppabc1 00000passwd
binary
lcd $backupdir
prompt off
mdelete *
mput *
bye
!
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END