forked from guschu79/plesk-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbkp-data.sh
executable file
·38 lines (36 loc) · 1.19 KB
/
bkp-data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Version: V1.0 - 07-10-2014
# Author: Gustavo Etchudez - mail: [email protected]
# URL: https://github.com/getchudez
#
# This script will do a backup of specific path of virtual host and virtual mail to local disk or remote server by rsync + ssh.
# You should define local and remote path and remote host where you want to copy your information.
# If you want to use remote option you should get ssh key defnied to could copy files to remote server.
#
#
R_HOST=""
F_VHOSTS="/var/www/vhosts/"
F_VMAIL="/var/qmail/mailnames/"
BACKUP_VHOSTS="/data/backups/vhosts/"
BACKUP_VMAIL="/data/backups/vmail/"
if [ "$1" == "LOCAL" ];then
echo rsync -apzh --delete $F_VHOSTS $BACKUP_VHOSTS
echo rsync -apzh --delete $F_VMAIS $BACKUP_VMAIL
fi
case "$1" in
local)
echo rsync -apzh --delete $F_VHOSTS $BACKUP_VHOSTS
echo rsync -apzh --delete $F_VMAIS $BACKUP_VMAIL
;;
remote)
echo rsync -apzh -e ssh --delete $F_VHOSTS $R_HOST:$BACKUP_VHOSTS
echo rsync -apzh -e ssh --delete $F_VMAIS $R_HOST:$BACKUP_VMAIL
;;
*)
echo $"Usage: $0 {local|remote}"
echo " local: sync files to local file system"
echo " remote: sync files to remote server by rsync + ssh"
RETVAL=1
esac
exit $RETVAL