觀看單篇文章
舊 2004-12-06, 10:34 AM   #2
mckan
等級:0 | 上線時間:1小時 | 升級還需:4小時
會員
 
mckan 的大頭照
 
註冊日期: 2001-01-17
文章: 121
精華: 0
有網友反應傳輸過程要有log... wget 本身即可以設定產生.
順便加了自動清理備份檔案的功能, 可以清理n 天前的檔案.

語法:
#!/bin/sh
#
# Cpanel Auto full backup version 1.0 (by Peter email:peterkan@yahoo.com)
# 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
mckan 目前未上線  
回覆時引用此文章