Skip to content
Snippets Groups Projects
Commit 7eb792a7 authored by root's avatar root
Browse files

Added rsync capabilitie (only local) to script. Destination can be defined via configuration file.

parent 12af4ea9
Branches
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"sqlPass": null, "sqlPass": null,
"dbNames": "all", "dbNames": "all",
"backupRoot": "/var/backups/sql/", "backupRoot": "/var/backups/sql/",
"backupRetainDays": 30 "backupRetainDays": 30,
"rsyncDest": null
} }
] ]
...@@ -37,6 +37,7 @@ if [ $dbNames == 'all' ]; then ...@@ -37,6 +37,7 @@ if [ $dbNames == 'all' ]; then
fi fi
backupRoot=$(cat $configFile | jq -r '.[0].backupRoot') backupRoot=$(cat $configFile | jq -r '.[0].backupRoot')
backupRetainDays=$(cat $configFile | jq -r '.[0].backupRetainDays') backupRetainDays=$(cat $configFile | jq -r '.[0].backupRetainDays')
rsyncDest=$(cat $configFile | jq -r '.[0].rsyncDest')
today=$(date +"%y%m%d") today=$(date +"%y%m%d")
...@@ -70,7 +71,7 @@ do ...@@ -70,7 +71,7 @@ do
continue continue
fi fi
backupPath=$backupRoot$dbName backupPath=$backupRoot/$dbName
mkdir -p ${backupPath} mkdir -p ${backupPath}
if [ -z $sqlPass ]; if [ -z $sqlPass ];
...@@ -106,3 +107,8 @@ do ...@@ -106,3 +107,8 @@ do
continue continue
fi fi
done done
if [ ! -z $rsyncDest ]; then
echo 'INFO: Rsync destination defined. Start rsync.'
rsync -r --delete $backupRoot $rsyncDest
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment