From: Robert Waffen Date: Tue, 30 Jun 2020 10:59:29 +0000 (+0200) Subject: add zelos update script X-Git-Tag: 0.4.1~7 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=ef987e2330cc152c5fa958343b709195bd4c985c;p=pixelpark%2Fpp-admin-tools.git add zelos update script --- 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 index 0000000..8b4132e --- /dev/null +++ b/bin/zelos-make_backup_and_do_update.sh.sh @@ -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