Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo Welcome to this backup script on $(date).
- echo first we are going to create rar files for each domain.
- cd /
- cd var
- cd www
- cd vhosts
- echo We are now in the right directory, now rar will be executed... This will take a long time.
- for folder in */; do rar a -m0 -r "${folder%/}.rar" "$folder"; done
- echo Process complete. Moving files to temp space.
- mv *.rar /root/backup/files
- echo Moving completed.
- echo Changing working directory
- cd /
- cd root
- cd backup
- cd sql
- echo Working directory changed.
- echo Commencing MySQL backup...
- # Optional variables for a backup script
- MYSQL_USER="admin"
- MYSQL_PASS=`cat /etc/psa/.psa.shadow`
- BACKUP_DIR=/root/backup/sql/$(date +%F);
- test -d "$BACKUP_DIR" || mkdir -p "$BACKUP_DIR"
- # Get the database list, exclude information_schema
- for db in $(mysql -B -s -u $MYSQL_USER --password=$MYSQL_PASS -e 'show databases' | grep -v information_schema)
- do
- # dump each database in a separate file
- echo Making backup of database "$db".
- mysqldump -u $MYSQL_USER --password=$MYSQL_PASS "$db" | gzip > "$BACKUP_DIR/$db.sql.gz"
- done
- echo Done backupping all databases.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement