vzdump hook missing NODE name variable

jmjosebest

Renowned Member
Jan 16, 2009
192
37
93
Hello,

We want that the VPS performs a stop when the backup is finalized.

We have tried it, and it works perfectly, but we have to put the nodename by hand:

system ("pvesh create /nodes/test1/qemu/$vmid/status/stop");

and we want to pass it to the script as a parameter or obtain it in another way.
The script code is the following :

Code:
#!/usr/bin/perl -w
use strict;
my $phase = shift;
my $mode = shift;
my $vmid = shift;

if ($phase eq 'log-end') {
        system ("pvesh create /nodes/test1/qemu/$vmid/status/stop");
}
exit (0);

We want to make the node name test1 be a variable like it is $vmid.

We have seen the variable $ENV{HOSTNAME}. If we execute it by SSH in the node directly it returns the hostname correctly, but when we execute it in the script it returns the VM name.

Is there a variable to obtain the nodename or any other way to make what we want?

Thanks in advance.
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!