hi,
I'm trying to wake my HTPC which hosts a PBS-VM up before starting a backup. So I wrote a little bash script as hook for vzdump:
... and modified /etc/vzdump.conf:
if i run
What did I do wrong?
I'm trying to wake my HTPC which hosts a PBS-VM up before starting a backup. So I wrote a little bash script as hook for vzdump:
Bash:
root@pve:~# cat /usr/bin/backup-hook-script
#!/bin/bash
touch /var/tmp/hooktest # for testing purposes
# INSTALL net rpc COMMAND BY RUNNING:
# apt update && apt install samba-common-bin
# VARIABLES:
WOLUUID='uuid=<opnsense uuid>'
APIKEY="<opnsense apikey>"
SECRET="<opnsense apikey secret>"
HOST="opnsense.mydomain.local"
case "${1}" in
job-start)
# wake HTPC that hosts PBS-VM
# wake via wakeonlan command
#wakeonlan <macaddress>
# wake via opnsense API
curl -XPOST -d $WOLUUID -g -k -u $APIKEY:$SECRET "https://"$HOST":443/api/wol/wol/set/"
echo "waiting 90s..."
sleep 90
echo "PBS should be up now. Continuing..."
;;
job-end)
net rpc -S <HTPC-IP> -U <user>%<supersecretpassword> shutdown -t 1 # shut HTPC down again
;;
esac
... and modified /etc/vzdump.conf:
Code:
root@pve:~# cat /etc/vzdump.conf
# vzdump default settings
#tmpdir: DIR
#dumpdir: DIR
#storage: STORAGE_ID
#mode: snapshot|suspend|stop
#bwlimit: KBPS
#ionice: PRI
#lockwait: MINUTES
#stopwait: MINUTES
#size: MB
#stdexcludes: BOOLEAN
#mailto: ADDRESSLIST
#maxfiles: N
script: /usr/bin/backup-hook-script
#exclude-path: PATHLIST
#pigz: N
if i run
/usr/bin/backup-hook-script job-start
or /usr/bin/backup-hook-script job-end
the HTPC/PBS wakes up and shuts down correctly, so my script should be working. To see if the script even gets executed I added the line touch /var/tmp/hooktest # for testing purposes
, but theres no /var/tmp/hooktest file created when I run the backup. I get TASK ERROR: could not activate storage 'PBS': PBS: error fetching datastores - 500 Can't connect to pbs.mydomain.local:8007 (No route to host)
straight away.What did I do wrong?
Last edited: