Update pbs-zfs-daily.sh

Bugfixes to Beta
This commit is contained in:
Chriz
2024-04-29 13:13:19 +02:00
committed by GitHub
parent 91c7e98bae
commit c84c6d900c

View File

@@ -33,12 +33,16 @@ echo "zfs_auto_snapshot_label=$ZPUSHLABEL" >> /etc/bashclub/$SOURCEHOST.conf
scp /tmp/90000_checkzfs $SOURCEHOST:/var/lib/check_mk_agent/spool/90000_checkzfs_$(hostname)_$ZPOOLSRC scp /tmp/90000_checkzfs $SOURCEHOST:/var/lib/check_mk_agent/spool/90000_checkzfs_$(hostname)_$ZPOOLSRC
if [ "$BACKUPSERVER" == "no" ]; then exit if [[ "$BACKUPSERVER" == "no" ]]
then
echo No Backup configured in this Run
exit
fi fi
PRUNEJOB=$(ssh $PBSHOST proxmox-backup-manager prune-job list --output-format json-pretty | grep -m 1 "id" | cut -d'"' -f4)
### ###
PRUNEJOB=$(ssh $PBSHOST proxmox-backup-manager prune-job list --output-format json-pretty | grep -m 1 "id" | cut -d'"' -f4)
if [ $(date +%u) == $MAINTDAY ]; then if [ $(date +%u) == $MAINTDAY ]; then
echo "MAINTENANCE" echo "MAINTENANCE"
@@ -47,7 +51,7 @@ PRUNEJOB=$(ssh $PBSHOST proxmox-backup-manager prune-job list --output-format js
ssh root@$PBSHOST proxmox-backup-manager garbage-collection start $BACKUPSTOREPBS ssh root@$PBSHOST proxmox-backup-manager garbage-collection start $BACKUPSTOREPBS
else else
echo "Today no Maintenance" echo "Today no Maintenance"
fi fi
ssh root@$SOURCEHOST zpool scrub -s $ZPOOLSRC ssh root@$SOURCEHOST zpool scrub -s $ZPOOLSRC
@@ -57,7 +61,7 @@ fi
### one Day is 86400 Seconds, so we going Condition grey if no new Status File will be pushed ### one Day is 86400 Seconds, so we going Condition grey if no new Status File will be pushed
ssh root@$SOURCEHOST vzdump --node $SOURCEHOSTNAME --storage $BACKUPSTORE --exclude $BACKUPEXCLUDE --mode snapshot --all 1 --notes-template '{{guestname}}' echo ssh root@$SOURCEHOST vzdump --node $SOURCEHOSTNAME --storage $BACKUPSTORE --exclude $BACKUPEXCLUDE --mode snapshot --all 1 --notes-template '{{guestname}}'
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo command returned 0 is good echo command returned 0 is good
@@ -73,7 +77,7 @@ scp /tmp/90000_checkpbs root@$SOURCEHOST:/var/lib/check_mk_agent/spool
### ###
ssh root@$SOURCEHOST pvesm set $BACKUPSTORE --disable 1 ssh root@$SOURCEHOST pvesm set $BACKUPSTORE --disable 1
if [ $(date +%u) == $MAINTDAY ]; then ssh root@$PBSHOST proxmox-backup-manager verify backup if [ $(date +%u) == $MAINTDAY ]; then ssh root@$PBSHOST proxmox-backup-manager verify backup; fi
/etc/cron.daily/zfs-auto-snapshot #protecting all Datasets/ZVOLs except the Replicas with daily Snaps /etc/cron.daily/zfs-auto-snapshot #protecting all Datasets/ZVOLs except the Replicas with daily Snaps
@@ -81,7 +85,11 @@ scp /tmp/90000_checkpbs root@$SOURCEHOST:/var/lib/check_mk_agent/spool
apt dist-upgrade -y apt dist-upgrade -y
ssh $PBSHOST apt dist-upgrade -y
if [[ "$SHUTDOWN" == "yes" ]]
if [ "$SHUTDOWN" == "yes" ]; then shutdown now then
shutdown now
else
echo no Shutdown configured - Next run has to be set in crontab!
fi fi