]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
add zelos update script
authorRobert Waffen <rwaffen@gmail.com>
Tue, 30 Jun 2020 10:59:29 +0000 (12:59 +0200)
committerRobert Waffen <rwaffen@gmail.com>
Tue, 30 Jun 2020 10:59:29 +0000 (12:59 +0200)
bin/zelos-make_backup_and_do_update.sh.sh [new file with mode: 0644]

diff --git a/bin/zelos-make_backup_and_do_update.sh.sh b/bin/zelos-make_backup_and_do_update.sh.sh
new file mode 100644 (file)
index 0000000..8b4132e
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+# by @rwaffen
+
+#update zelos
+DATE=$(date '+%Y-%m-%d')
+is_mounted=$(mount | grep /mnt/storagebox/backup -c)
+backup_box_pass=$1 #see tpm
+
+if [ -z "${backup_box_pass}" ]; then
+  echo "Bitte Password aus TPM entnehmen!"
+  exit 1
+fi
+
+# mount hetzner backup disk
+if [ $is_mounted -ne 1 ]; then
+  mount.cifs -o user=u234365,pass=${backup_box_pass} //u234365.your-storagebox.de/backup /mnt/storagebox/backup
+fi
+
+# delete older backups
+find /mnt/storagebox/backup -mtime +20 -delete
+
+# make file backups
+echo "packe /root"
+tar cfz /mnt/storagebox/backup/${DATE}_root.tgz /root
+
+echo "packe /opt/asterisk"
+tar cfz /mnt/storagebox/backup/${DATE}_asterisk.tgz /opt/asterisk
+
+echo "packe /etc"
+tar cfz /mnt/storagebox/backup/${DATE}_etc.tgz /etc
+
+echo "packe /home"
+tar cfz /mnt/storagebox/backup/${DATE}_home.tgz /home
+
+# make db backup
+echo "mache db dump"
+echo "kann so 60min. dauern..."
+time /root/MysqlDumps/backupZabbixDB.sh
+
+mv $(find /opt/dbstorage -name "*.bz2" -daystart -ctime 0) /mnt/storagebox/backup
+
+# update system
+yum update -y
+
+# reboot
+systemctl reboot