-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup.sh
28 lines (17 loc) · 822 Bytes
/
backup.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
#!/bin/sh
USER="username"
PASSWD="password"
URL="https://www.midominio.com/cpanel"
PATH_FILE_COOKIE=cookie_midominio
BACKUP_DB="getsqlbackup"
DIR_BACKUP_DB=/var/backups
SCHEMA_DB="schema.sql.gz"
BACKUP_FILE="$BACKUP_DB/$SCHEMA_DB"
echo "stating $URL backup"
echo "Log in in Cpanel"
wget "$URL/login" --post-data "user=$USER&pass=$PASSWD" --no-check-certificate --keep-session-cookies --save-cookies $PATH_FILE_COOKIE -S -O /dev/null
echo "downloading sql file: $BACKUP_FILE"
wget "$URL/$BACKUP_FILE" --no-check-certificate --keep-session-cookies --load-cookies $PATH_FILE_COOKIE=
cp $SCHEMA_DB $DIR_BACKUP_DB
rm $PATH_FILE_COOKIE
echo "done"