Pages

Bài đăng phổ biến

Showing posts with label backup. Show all posts
Showing posts with label backup. Show all posts

Thursday, February 2, 2012

Cpanel : Backup and restore multi website by script

Backup:

Create a file with name backup.sh


for i in $(ls /var/cpanel/users)
do /scripts/pkgacct $i
done
Restore:

Create a file with name restore.sh:

for x in $(ls cpmove-*.tar.gz | cut -d "." -f 1); do /scripts/restorepkg $x; done

or

#!/bin/bash
for i in $(cat /backup/restore.txt)
do /scripts/restorepkg $i
done

With restore.txt is list username and file backup is in /home dir


or



#!/bin/bash
for x in $(ls /home/backup-*.tar.gz | cut -d "_" -f 3 | cut -d "." -f 1);
do   /scripts/restorepkg $x;
done
echo "Written by Nguyen Si Nhan"


Nguyễn Sĩ Nhàn

Sunday, November 13, 2011

How to restore or backup database mysql by cmd (command)


Restore
mysql -u user_name -p your_password database_name < file_name.sql
 gzip -dc <database.sql.gz |mysql -u root -p databasename

Backup
mysqldump -u user_name -p your_password databasename > file_name.sql
mysqldump -u user_name -p databasename | gzip > database.sql.gz

Nguyen Si Nhan