]>
git.proxmox.com Git - pve-manager.git/blob - vzdump-hook-script.pl
3 # example hook script for vzdump (--script option)
7 print "HOOK: " . join (' ', @ARGV) . "\n";
11 if ($phase eq 'job-start' ||
12 $phase eq 'job-end' ||
13 $phase eq 'job-abort') {
15 my $dumpdir = $ENV{DUMPDIR
};
17 my $storeid = $ENV{STOREID
};
19 print "HOOK-ENV: dumpdir=$dumpdir;storeid=$storeid\n";
23 } elsif ($phase eq 'backup-start' ||
24 $phase eq 'backup-end' ||
25 $phase eq 'backup-abort' ||
26 $phase eq 'log-end' ||
27 $phase eq 'pre-stop' ||
28 $phase eq 'pre-restart') {
30 my $mode = shift; # stop/suspend/snapshot
34 my $vmtype = $ENV{VMTYPE
}; # openvz/qemu
36 my $dumpdir = $ENV{DUMPDIR
};
38 my $storeid = $ENV{STOREID
};
40 my $hostname = $ENV{HOSTNAME
};
42 # tarfile is only available in phase 'backup-end'
43 my $tarfile = $ENV{TARFILE
};
45 # logfile is only available in phase 'log-end'
46 my $logfile = $ENV{LOGFILE
};
48 print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;storeid=$storeid;hostname=$hostname;tarfile=$tarfile;logfile=$logfile\n";
50 # example: copy resulting backup file to another host using scp
51 if ($phase eq 'backup-end') {
52 #system ("scp $tarfile backup-host:/backup-dir") == 0 ||
53 # die "copy tar file to backup-host failed";
56 # example: copy resulting log file to another host using scp
57 if ($phase eq 'log-end') {
58 #system ("scp $logfile backup-host:/backup-dir") == 0 ||
59 # die "copy log file to backup-host failed";
64 die "got unknown phase '$phase'";