File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 31
31
32
32
# the file
33
33
SQLFILE=${cpath} /${sqldbs[$i]} _$suffix .sql.gz
34
- mysqldump -c -h $mysqlhost --user ${usernames[$i]} --password=${passwords[$i]} ${sqldbs[$i]} | gzip > $SQLFILE
35
-
36
- scp ${SQLFILE} ${backup_user} @${backup_server} :~ /dir_backups/database
37
-
34
+
35
+ if mysqldump -c -h $mysqlhost --user ${usernames[$i]} --password=${passwords[$i]} ${sqldbs[$i]} | gzip > $SQLFILE
36
+ then
37
+ scp ${SQLFILE} ${backup_user} @${backup_server} :~ /dir_backups/database
38
+ else
39
+ echo " [!!ERROR!!] Failed to create the file $SQLFILE "
40
+ fi
41
+
42
+
38
43
# on the server that keeps the database files, add this cron rule. If you want to keep more than 10 days of data, just change 10.
39
44
# 0 0 * * * find /home/user/dir_backups/database/* -type f -mtime +10 -exec rm {} \;
40
45
You can’t perform that action at this time.
0 commit comments