summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Ritter2022-05-16 15:06:11 +0200
committerSteffen Ritter2022-05-16 15:06:11 +0200
commit2da9a58b6fe65df086c6655692b22a3b2baa2fd2 (patch)
tree8bea8e6f99840362c8407dd524d1bab17141ebd4
parent[SSPS] slx-admin: Set session length to one week, set passthrough cat (diff)
downloadsetup-scripts-2da9a58b6fe65df086c6655692b22a3b2baa2fd2.tar.gz
setup-scripts-2da9a58b6fe65df086c6655692b22a3b2baa2fd2.tar.xz
setup-scripts-2da9a58b6fe65df086c6655692b22a3b2baa2fd2.zip
[SSPS] Add simple weekly config backup
Do an admin a favor who screws up his config and has not made a backup on his own. Maybe extend that feature later. refs: #3834
-rwxr-xr-xsatellit_installer/static_files/system/etc/cron.weekly/backup-satconfig.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/satellit_installer/static_files/system/etc/cron.weekly/backup-satconfig.sh b/satellit_installer/static_files/system/etc/cron.weekly/backup-satconfig.sh
new file mode 100755
index 0000000..ae97535
--- /dev/null
+++ b/satellit_installer/static_files/system/etc/cron.weekly/backup-satconfig.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+DIR="/root/backup/"
+BACKUP_FILE=$(/opt/taskmanager/scripts/system-backup | tail -n 1 | cut -d' ' -f 2)
+
+mkdir -p "$DIR"
+cd "$DIR" || exit 1
+
+mv $BACKUP_FILE $DIR
+
+# remove backups older than 180 days
+find $DIR/*.tgz -type f -mtime +180 -exec rm -f {} \;