Merge pull request #3 from bashclub/main

re
This commit is contained in:
Chriz
2024-06-22 11:49:31 +02:00
committed by GitHub
4 changed files with 101 additions and 73 deletions

View File

@@ -4,6 +4,7 @@ SSHPORT='22' #SSH Port, usually default 22 internally
BACKUPSERVER=no #use yes for triggering Proxmox Backup to Store BACKUPSERVER=no #use yes for triggering Proxmox Backup to Store
MAINTDAY=7 #1 Monday to 7 Sunday, dont start your System too late MAINTDAY=7 #1 Monday to 7 Sunday, dont start your System too late
SHUTDOWN=no #No be there anymore SHUTDOWN=no #No be there anymore
UPDATES=yes #Do PVE and PBS Updates after run
SOURCEHOST='192.168.50.200' # IP from Proxmox VE System to be backuped and replicated daily SOURCEHOST='192.168.50.200' # IP from Proxmox VE System to be backuped and replicated daily
SOURCEHOSTNAME='pve3' #Hostname of Proxmox VE System to be backuped and replicated daily SOURCEHOSTNAME='pve3' #Hostname of Proxmox VE System to be backuped and replicated daily

18
dynroute.sh Normal file
View File

@@ -0,0 +1,18 @@
# DDNS Name und Gateway
# usage dynroute.sh ddnsname yourgatewayrouter
# assuming a shutdown after usage, old routes will "not" be deleted
DDNS_HOSTNAME=$1
GATEWAY=$2
#DNS via One
ip route add 1.1.1.1 via 192.168.66.1
echo "nameserver 1.1.1.1" > /etc/resolv.conf
# ddns auflösen
CURRENT_IP=$(dig +short $DDNS_HOSTNAME)
if [[ -z "$CURRENT_IP" ]]; then
echo "Failed to resolve IP for $DDNS_HOSTNAME"
exit 1
fi
# route setzen
ip route add $CURRENT_IP via $GATEWAY

View File

@@ -28,8 +28,10 @@ echo "zfs_auto_snapshot_label=$ZPUSHLABEL" >> /etc/bashclub/$SOURCEHOST.conf
/usr/bin/bashclub-zsync -d -c /etc/bashclub/$SOURCEHOST.conf /usr/bin/bashclub-zsync -d -c /etc/bashclub/$SOURCEHOST.conf
CHECKZFS=$(which checkzfs)
# So one Day has 1440 Minutes, so we go condition Yellow on 1500 # So one Day has 1440 Minutes, so we go condition Yellow on 1500
/usr/local/bin/checkzfs --source $SOURCEHOST --replicafilter "$ZFSTRGT/" --filter "#$ZFSROOT/|#$ZFSSECOND/" --threshold 1500,2000 --output checkmk --prefix pull-$(hostname):$ZPUSHTAG> /tmp/cmk_tmp.out && ( echo "<<<local>>>" ; cat /tmp/cmk_tmp.out ) > /tmp/90000_checkzfs $CHECKZFS --source $SOURCEHOST --replicafilter "$ZFSTRGT/" --filter "#$ZFSROOT/|#$ZFSSECOND/" --threshold 1500,2000 --output checkmk --prefix pull-$(hostname):$ZPUSHTAG> /tmp/cmk_tmp.out && ( echo "<<<local>>>" ; cat /tmp/cmk_tmp.out ) > /tmp/90000_checkzfs
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
@@ -84,8 +86,15 @@ scp /tmp/90000_checkpbs root@$SOURCEHOST:/var/lib/check_mk_agent/spool
#doing updates without regeret #doing updates without regeret
apt dist-upgrade -y if [[ "$UPDATES" == "yes" ]]
ssh $PBSHOST apt dist-upgrade -y then
apt dist-upgrade -y
ssh $PBSHOST apt dist-upgrade -y
else
echo no Updates configured - Consider updating more often!
fi
if [[ "$SHUTDOWN" == "yes" ]] if [[ "$SHUTDOWN" == "yes" ]]
then then