fix #4502: ui: VM OS type: the l26 type is also compatible with Linux 6.x
[pve-manager.git] / vzdump-hook-script.pl
1 #!/usr/bin/perl -w
2
3 # example hook script for vzdump (--script option)
4
5 use strict;
6
7 print "HOOK: " . join (' ', @ARGV) . "\n";
8
9 my $phase = shift;
10
11 if ($phase eq 'job-start' ||
12 $phase eq 'job-end' ||
13 $phase eq 'job-abort') {
14
15 my $dumpdir = $ENV{DUMPDIR};
16
17 my $storeid = $ENV{STOREID};
18
19 print "HOOK-ENV: dumpdir=$dumpdir;storeid=$storeid\n";
20
21 # do what you want
22
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' ||
29 $phase eq 'post-restart') {
30
31 my $mode = shift; # stop/suspend/snapshot
32
33 my $vmid = shift;
34
35 my $vmtype = $ENV{VMTYPE}; # openvz/qemu
36
37 my $dumpdir = $ENV{DUMPDIR};
38
39 my $storeid = $ENV{STOREID};
40
41 my $hostname = $ENV{HOSTNAME};
42
43 # tarfile is only available in phase 'backup-end'
44 my $tarfile = $ENV{TARFILE};
45
46 # logfile is only available in phase 'log-end'
47 my $logfile = $ENV{LOGFILE};
48
49 print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;storeid=$storeid;hostname=$hostname;tarfile=$tarfile;logfile=$logfile\n";
50
51 # example: copy resulting backup file to another host using scp
52 if ($phase eq 'backup-end') {
53 #system ("scp $tarfile backup-host:/backup-dir") == 0 ||
54 # die "copy tar file to backup-host failed";
55 }
56
57 # example: copy resulting log file to another host using scp
58 if ($phase eq 'log-end') {
59 #system ("scp $logfile backup-host:/backup-dir") == 0 ||
60 # die "copy log file to backup-host failed";
61 }
62
63 } else {
64
65 die "got unknown phase '$phase'";
66
67 }
68
69 exit (0);