#!/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 https://$cpuser:$cppass@www.$domain:2083/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 https://$cpuser:$cppass@www.$domain:2083/getsqlbackup/$mydb.gz -O $store_dir/$mydb.gz-$TS -o $store_dir/mysqlbackup-$domain-$TS.log