vzdump logfile hook script

mumichi

New Member
Oct 2, 2010
3
0
1
Hello,

run vzdump with a script lfrom the example perl Script (/usr/share/doc/vzdump/examples/hook-script.pl):
...

# example: copy resulting files to another host using scp
#if ($phase eq 'backup-end') {
# system ("scp $tarfile $logfile backup-host:/backup-dir") == 0 ||
# die "copy to backup-host failed";
# unlink $tarfile;
# unlink $logfile;
#}
...
don't work.
Because the Log Fle is at this time not closed and the vzdump command failed with an error.
/backup/foo.log: No such file or directory
INFO: copy to backup-host failed at /usr/local/bin/hook.pl line 43.

I hope you can fix this.

Thanks

Michael
 
Hello,

in the Step backup-end the log file is not closed in the Perl Script VZDump.pm
So no LOG File exist at this time.
I only used the example hook-script.pl
So no log can be transfered with scp because no LOG file is created.
After the scp command, the command unlink $logfile is also not possibly because no log file exist at this time.
After the vzdump has dumped the VM, there exist an log file.
Is only a time problem with the step backup-end and when the log file is be created.
It where very nice when i can copy the *.tgz and *.log to the backup server via scp with the hook-script.pl.
When in the hook-sript.pl the line is:
scp $tarfile $logfile backup-host:/backup-dir"
no tarfile will be transferd
error message: INFO: copy to backup-host failed at /usr/local/bin/hook.pl line 43.
If you change this to:
scp $tarfile backup-host:/backup-dir" (delete the entry $logfile)
then no error will be produced and the tar file is transfered to the server.
When you have many VM's that where backup and you do this every night there are many many log files locally. There mus be copied manually or with a extra cron job.
So i hope you understand now the problem is ?

Regards

Michael