-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsempakan.sh
95 lines (92 loc) · 3.77 KB
/
sempakan.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Gembalah cPanel Scripts - HOW TO
# v0.2
# /-------------------------------------------------------/
#
# Backup cpanel account
# $ gembalah -b <username/domain>
#
# Download and restore cpanel account from remote server
# $ gembalah -d <username> <server>
#
# Restore cpanel account
# $ gembalah -r <username>
# /-------------------------------------------------------/
# Configure your requirements here
owner="sempak:sempak"
sempakan="/home/sempak/public_html/"
strip=`hostname | sed "s/.in-hell.com//"`
# Progress animation
a=1
sp="/-\|"
echo -n ' '
while true
do
printf "\b${sp:a++%${#sp}:1}"
done
while getopts "b:d:r:h:" options
do
case "$options" in
"b")
domain=`grep $OPTARG /etc/trueuserdomains | awk {'print $1'} | cut -d':' -f1`
acc=`grep $OPTARG /etc/trueuserdomains | awk {'print $2'}`
if [ "$OPTARG" == "$acc" ]; then
echo "[+] Creating full backups user $OPTARG"
/scripts/pkgacct $OPTARG > /dev/null
file="/home/cpmove-$OPTARG.tar.gz"
echo "[+] Backups created on $file"
echo "[+] Processing to dummy ..."
chown $owner $file > /dev/null
chmod 644 $file > /dev/null
mv $file $sempakan > /dev/null
echo "[+] Success! http://$strip.dracoola.net/cpmove-$OPTARG.tar.gz"
echo "[+] Do this on your remote server -> $0 -d $OPTARG $strip"
elif [ "$OPTARG" == "$domain" ]; then
echo "[+] Creating full backups domain $OPTARG"
/scripts/pkgacct $acc > /dev/null
domfile="/home/cpmove-$acc.tar.gz"
echo "[+] Backups created on $domfile"
echo "[+] Processing to dummy ..."
chown $owner $domfile > /dev/null
chmod 644 $domfile > /dev/null
mv $domfile $sempakan > /dev/null
echo "[+] Success! http://$strip.dracoola.net/cpmove-$acc.tar.gz"
echo "[+] Do this on your remote server -> $0 -d $acc $strip"
else
echo "domain or account not exist, please check!"
exit 0
fi
;;
"d")
echo "[+] Download is in progress ..."
wget -q -nv --user-agent=DraCoola/1.1 http://$3.dracoola.net/cpmove-$OPTARG.tar.gz -O /home/cpmove-$OPTARG.tar.gz
echo "[+] The backups sucessfully downloaded at /home/cpmove-$OPTARG.tar.gz with `ls -lah /home/cpmove-$OPTARG.tar.gz | awk '{print $5}'`bytes"
echo -n "[?] Do you want to restore the cpmove-$OPTARG.tar.gz? [Y/n] "; read yn
case $yn in
[Yy]* ) echo "[+] Restoring account for $OPTARG is in progress ..."; /scripts/restorepkg $OPTARG > /dev/null; echo "[+] Restore account for $OPTARG complete!";;
[Nn]* ) echo "[!] Complete without restoring data"; exit;;
* ) echo "Default Answer (YES)"; /scripts/restorepkg $OPTARG > /dev/null;;
esac
;;
"r")
echo -n "[?] Do you want to restore the $OPTARG? [Y/n] "; read $yn
case $yn in
[Yy]* ) /scripts/restorepkg $OPTARG > /dev/null;;
[Nn]* ) exit;;
* ) echo "Default Answer (YES)"; /scripts/restorepkg $OPTARG > /dev/null;;
esac
echo "[+] Restore complete"
;;
*)
echo "DraCoola cPanel Simple Scripts"
echo "<[email protected]>"
echo "Usage: $0 [OPTIONS]"
echo " "
echo "Options: "
echo " -b <username/domain> Backup packages"
echo " -d <username> <servername> Download packages from another server"
echo " -help Display this Messages"
echo " -r <username> Restore packages"
;;
esac
done