# scp aplinfo/aplinfo.dat aplinfo.dat.gz aplinfo/aplinfo.dat.asc pve.proxmox.com:/home/ftp/appliances/
.PHONY: install
-install: country.dat vznet.conf vzdump.conf
+install: country.dat vznet.conf vzdump.conf vzdump-hook-script.pl
install -d ${DESTDIR}/usr/share/${PACKAGE}
install -d ${DESTDIR}/usr/share/man/man1
- install -d ${DESTDIR}/usr/share/doc/${PACKAGE}
+ install -d ${DOCDIR}/examples
install -d ${DESTDIR}/var/lib/${PACKAGE}
install -d ${DESTDIR}/var/lib/vz/images
install -d ${DESTDIR}/var/lib/vz/template/cache
install -d ${DESTDIR}/var/lib/vz/template/qemu
install -D -m 0644 vzdump.conf ${DESTDIR}/etc/vzdump.conf
install -D -m 0755 vznet.conf ${DESTDIR}/etc/vz/vznet.conf
- install -m 0644 copyright ${DESTDIR}/usr/share/doc/${PACKAGE}
- install -m 0644 debian/changelog.Debian ${DESTDIR}/usr/share/doc/${PACKAGE}
+ install -m 0644 vzdump-hook-script.pl ${DOCDIR}/examples/vzdump-hook-script.pl
+ install -m 0644 copyright ${DOCDIR}
+ install -m 0644 debian/changelog.Debian ${DOCDIR}
install -m 0644 country.dat ${DESTDIR}/usr/share/${PACKAGE}
set -e && for i in ${SUBDIRS}; do ${MAKE} -C $$i $@; done
=head1 HOOK SCRIPT
-You can specify a hook script with option C<--script>. This script is called at various phases of the backup process, with parameters accordingly set. You can find an example in the documentation directory (C<hook-script.pl>).
+You can specify a hook script with option C<--script>. This script is called at various phases of the backup process, with parameters accordingly set. You can find an example in the documentation directory (C<vzdump-hook-script.pl>).
=head1 EXCLUSIONS (OpenVZ only)
--- /dev/null
+#!/usr/bin/perl -w
+
+# example hook script for vzdump (--script option)
+
+use strict;
+
+print "HOOK: " . join (' ', @ARGV) . "\n";
+
+my $phase = shift;
+
+if ($phase eq 'job-start' ||
+ $phase eq 'job-end' ||
+ $phase eq 'job-abort') {
+
+ # do what you want
+
+} elsif ($phase eq 'backup-start' ||
+ $phase eq 'backup-end' ||
+ $phase eq 'backup-abort' ||
+ $phase eq 'log-end' ||
+ $phase eq 'pre-stop' ||
+ $phase eq 'pre-restart') {
+
+ my $mode = shift; # stop/suspend/snapshot
+
+ my $vmid = shift;
+
+ my $vmtype = $ENV{VMTYPE}; # openvz/qemu
+
+ my $dumpdir = $ENV{DUMPDIR};
+
+ my $hostname = $ENV{HOSTNAME};
+
+ # tarfile is only available in phase 'backup-end'
+ my $tarfile = $ENV{TARFILE};
+
+ # logfile is only available in phase 'log-end'
+ my $logfile = $ENV{LOGFILE};
+
+ print "HOOK-ENV: vmtype=$vmtype;dumpdir=$dumpdir;hostname=$hostname;tarfile=$tarfile;logfile=$logfile\n";
+
+ # example: copy resulting backup file to another host using scp
+ if ($phase eq 'backup-end') {
+ #system ("scp $tarfile backup-host:/backup-dir") == 0 ||
+ # die "copy tar file to backup-host failed";
+ }
+
+ # example: copy resulting log file to another host using scp
+ if ($phase eq 'log-end') {
+ #system ("scp $logfile backup-host:/backup-dir") == 0 ||
+ # die "copy log file to backup-host failed";
+ }
+
+} else {
+
+ die "got unknown phase '$phase'";
+
+}
+
+exit (0);