|
@@ -37,6 +37,7 @@ ENABLE_VERIFICATION="no"
|
37
|
37
|
export TEXTDOMAIN=${PROJECT_NAME}-backup-remote
|
38
|
38
|
export TEXTDOMAINDIR="/usr/share/locale"
|
39
|
39
|
|
|
40
|
+# utilities needed for backup commands
|
40
|
41
|
UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
|
41
|
42
|
for f in $UTILS_FILES
|
42
|
43
|
do
|
|
@@ -102,19 +103,20 @@ function restart_site {
|
102
|
103
|
|
103
|
104
|
function backup_configuration {
|
104
|
105
|
echo $"Backing up ${PROJECT_NAME} configuration files"
|
105
|
|
- if [ ! -d /root/tempbackupconfig ]; then
|
106
|
|
- mkdir -p /root/tempbackupconfig
|
|
106
|
+ temp_backup_dir=/root/tempbackupconfig
|
|
107
|
+ if [ ! -d $temp_backup_dir ]; then
|
|
108
|
+ mkdir -p $temp_backup_dir
|
107
|
109
|
fi
|
108
|
|
- cp -f $CONFIG_FILE /root/tempbackupconfig
|
109
|
|
- cp -f $COMPLETION_FILE /root/tempbackupconfig
|
|
110
|
+ cp -f $CONFIG_FILE $temp_backup_dir
|
|
111
|
+ cp -f $COMPLETION_FILE $temp_backup_dir
|
110
|
112
|
if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
|
111
|
|
- cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig
|
|
113
|
+ cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
|
112
|
114
|
fi
|
113
|
115
|
# nginx password hashes
|
114
|
116
|
if [ -f /etc/nginx/.htpasswd ]; then
|
115
|
|
- cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd
|
|
117
|
+ cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd
|
116
|
118
|
fi
|
117
|
|
- backup_directory_to_friend /root/tempbackupconfig config
|
|
119
|
+ backup_directory_to_friend $temp_backup_dir config
|
118
|
120
|
}
|
119
|
121
|
|
120
|
122
|
function backup_users {
|
|
@@ -278,20 +280,21 @@ function backup_admin_readme {
|
278
|
280
|
|
279
|
281
|
function backup_mariadb {
|
280
|
282
|
if [ ${#DATABASE_PASSWORD} -gt 1 ]; then
|
281
|
|
- if [ ! -d /root/tempmariadb ]; then
|
282
|
|
- mkdir /root/tempmariadb
|
|
283
|
+ temp_backup_dir=/root/tempmariadb
|
|
284
|
+ if [ ! -d $temp_backup_dir ]; then
|
|
285
|
+ mkdir $temp_backup_dir
|
283
|
286
|
fi
|
284
|
|
- mysqldump --password=$DATABASE_PASSWORD mysql user > /root/tempmariadb/mysql.sql
|
285
|
|
- if [ ! -s /root/tempmariadb/mysql.sql ]; then
|
|
287
|
+ mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql
|
|
288
|
+ if [ ! -s $temp_backup_dir/mysql.sql ]; then
|
286
|
289
|
echo $"Unable to backup MariaDB settings"
|
287
|
|
- rm -rf /root/tempmariadb
|
|
290
|
+ rm -rf $temp_backup_dir
|
288
|
291
|
# Send a warning email
|
289
|
292
|
echo $"Unable to export database settings" | mail -s "${PROJECT_NAME} backup to friends" $ADMIN_EMAIL_ADDRESS
|
290
|
293
|
exit 653
|
291
|
294
|
fi
|
292
|
|
- echo "$DATABASE_PASSWORD" > /root/tempmariadb/db
|
293
|
|
- chmod 400 /root/tempmariadb/db
|
294
|
|
- backup_directory_to_friend /root/tempmariadb mariadb
|
|
295
|
+ echo "$DATABASE_PASSWORD" > $temp_backup_dir/db
|
|
296
|
+ chmod 400 $temp_backup_dir/db
|
|
297
|
+ backup_directory_to_friend $temp_backup_dir mariadb
|
295
|
298
|
fi
|
296
|
299
|
}
|
297
|
300
|
|