My physical PBS server is set in it's BIOS to boot daily at 22:00 shortly after that, at 22:15 my PVE will start the daily backup job. To save energy I want to shutdown the PBS once the backup is finish. Here is how I was able t achieved it, with the help of @bluesite (Original Thread (German))
Preperation
Proxmox Virtual Enviroment (PVE) must be able to access the Proxmox Backup Server (PBS) without a Password using SSH.
(You need to generate a SSH-Key) Here is how to do that..
Make the Hook Skript
On the PVE crete a hook script file.
The content of the file must be as follows:
NOTE: "IP-ADDRESS-OF-PBS" must be replaced with the IP of your PBS.
Now the file needs to be made executable with:
Add the Hook Skript to your Backup Job
Still on the PVE machine we need to add a entry to the
add this entry at the bottom of your config file:
(Most settings in this file can be adjusted using the Graphical User Interface (GUI)
Done.
Preperation
Proxmox Virtual Enviroment (PVE) must be able to access the Proxmox Backup Server (PBS) without a Password using SSH.
(You need to generate a SSH-Key) Here is how to do that..
Make the Hook Skript
On the PVE crete a hook script file.
nano /usr/local/bin/vzdump-hook-script
The content of the file must be as follows:
Code:
#!/bin/bash
if [ "$1" == "job-end" ]; then
ssh root@IP-ADDRESS-OF-PBS "poweroff < /dev/null &"
fi
exit 0
If needed you can add additional arguments to your script, here is a example:
Code:
if [ "$1" == "backup-start" ]; then
etherwake xx:xx:xx:xx:xx #(mac Address of PBS Server)
ping pbsserver -c 60
fi
if [ "$1" == "backup-end" ]; then
fi
Now the file needs to be made executable with:
chmod +x /usr/local/bin/vzdump-hook-script
Add the Hook Skript to your Backup Job
Still on the PVE machine we need to add a entry to the
jobs.cfg
config file.nano /etc/pve/jobs.cfg
add this entry at the bottom of your config file:
script /usr/local/bin/vzdump-hook-script
(Most settings in this file can be adjusted using the Graphical User Interface (GUI)
Done.
Last edited: