vzdump hook missing NODE name variable

jmjosebest

Renowned Member
Jan 16, 2009
192
39
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: