有網友反應傳輸過程要有log... wget 本身即可以設定產生.
順便加了自動清理備份檔案的功能, 可以清理n 天前的檔案.
語法:
#!/bin/sh
#
# Cpanel Auto full backup version 1.0 (by Peter email:[email protected])
# Environment: Redhat Linux 8.0 , wget 1.81
#
# History:
# 2004-12-05 Version 1.0
# 1. Add the backup files auto-clean function.
# 2. Add the wget log during backup.
#
cpuser="username" # Username used to login to CPanel
cppass="password" # Password used to login to CPanel
domain="yourdomain.com" # Domain name where CPanel is run
mydb="mydb_name" # MySQL DB Name
store_dir="mydirectory" # The backup file directory path in local ex. /home/test/test1
file_keep_day=10 # the days that backup files will be kept (default: 10 day)
T=`date '+%m-%d-%Y'` # system date format MM-DD-YYYY
TS=`date '+%m-%d-%Y-%H%M%S'` # system date format MM-DD-YYYY-HhMinSS
#clean the files before $file_keep_day days
find $store_dir -name '*' -mtime +$file_keep_day | /usr/bin/xargs rm -f {}
#Full Backup
wget http://$cpuser:$cppass@www.$domain:2082/getbackup/backup-$domain-$T.tar.gz -O $store_dir/backup-$domain-$T.tar.gz -o $store_dir/backup-$domain-$T.log
#MySQL Backup -- add the time stamp in the tail of file
wget http://$cpuser:$cppass@www.$domain:2082/getsqlbackup/$mydb.gz -O $store_dir/$mydb.gz-$TS -o $store_dir/mysqlbackup-$domain-$TS.log
書籤