@@ -40,20 +40,21 @@ function get_config_parameters {
40
40
# Produces a backup of full database in a tar.gz file
41
41
42
42
function mysql_dump {
43
+ ssh $backup_user @$backup_host " mkdir -p $backup_remote_dir /$domain "
43
44
mysqldump --user $db_user --password=$db_password \
44
45
$db_name | gzip -c | ssh $backup_user @$backup_host " cat > \
45
- $backup_remote_dir /$( date +%Y%m%d) $db_name .sql.gz" \
46
+ $backup_remote_dir /$domain / $ ( date +%Y%m%d) $db_name .sql.gz" \
46
47
|| iferror " Backup for database named $db_name has failed" \
47
48
&& wp_simple_backup_files;
48
49
}
49
50
# function: wp_simple_backup_files
50
51
# Produces a tar.gz to a remote host
51
52
52
53
function wp_simple_backup_files {
53
- targz_file =" /tmp/$( date +%Y%m%d) $domain .tar.gz" ;
54
+ wp_targz =" /tmp/$( date +%Y%m%d) $domain .tar.gz" ;
54
55
if [[ -d $wp_path ]]; then
55
- tar czfp $targz_file -C $wp_path - \
56
- && scp " $targz_file " $backup_user @$backup_host :$backup_remote_dir /. \
56
+ tar czfp $wp_targz -C $wp_path . \
57
+ && scp $wp_targz $backup_user @$backup_host :$backup_remote_dir / $domain /. \
57
58
&& rm -f $targz_file \
58
59
|| iferror " Backup file not sended to $backup_host "
59
60
fi
@@ -64,7 +65,7 @@ function wp_simple_backup_files {
64
65
function nginx_site_backup {
65
66
if [[ -e /etc/nginx/sites-enabled/$domain .conf ]]; then
66
67
scp /etc/nginx/sites-enabled/$domain .conf \
67
- $backup_user @$backup_host :$backup_remote_dir /.
68
+ $backup_user @$backup_host :$backup_remote_dir /$domain / .
68
69
fi
69
70
}
70
71
0 commit comments