-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackup-wp.sh
38 lines (28 loc) · 1.04 KB
/
backup-wp.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/sh
#export filename=$(date +%Y%m%d-%H%M%S)
export filename=backup-website
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Start backup
# -----------.
echo "Backup mysql..."
mysqldump -uroot -pXXXX wpdb > /tmp/${filename}-mysql.sql
echo "Compress wordpress folder..."
cd /var/www/html && tar czf /tmp/${filename}-wp.tar.gz wordpress/
# Start remote copy
# -----------------
echo "Copy wordpress backup to nas01..."
scp /tmp/${filename}-wp.tar.gz [email protected]:/raid0/data/rilasci/Raspberry/raspb03-wp
echo "Copy mysql dump to nas01..."
scp /tmp/${filename}-mysql.sql [email protected]:/raid0/data/rilasci/Raspberry/raspb03-wp
# copia backup su wedoit remoto (cloudatcost)
echo "Copy wordpress backup to nas01..."
scp /tmp/${filename}-wp.tar.gz [email protected]:/home/user
echo "Copy mysql dump to nas01..."
scp /tmp/${filename}-mysql.sql [email protected]:/home/user
echo "Copy myself to nas01..."
scp ${0} [email protected]:/raid0/data/rilasci/Raspberry/raspb03-wp
# Finish
echo "Done!"