Forked from MartinMystikJonas/vzdump-hook-script.pl
Created
November 2, 2021 12:41
-
-
Save sor88/6c4e81d6cf33825811eb0ab3be983579 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl -w | |
| use strict; | |
| my $remote = 'carol@office.growjob.com::carol/dump'; | |
| my $phase = shift; | |
| if ($phase eq 'backup-end') { | |
| my $mode = shift; | |
| my $vmid = shift; | |
| my $vmtype = $ENV{VMTYPE}; | |
| my $tarfile = $ENV{TARFILE}; | |
| my $ext = ($vmtype eq "qemu") ? "vma.gz" : "tar.gz"; | |
| my $remotefile = "$remote/vzdump-$vmtype-$vmid-mirror.$ext"; | |
| print "MIRROR BACKUP HOOK: $tarfile -> $remotefile\n"; | |
| if ($phase eq 'backup-end') { | |
| my $command = "rsync -h --password-file=/etc/backup_rsync_password --compress-level=6 --stats --partial-dir=.rsync-partial --backup --suffix=.prev $tarfile $remotefile\n"; | |
| print $command; | |
| system ($command) == 0 || system ($command) == 0 || die "rsync to backup mirror failed"; | |
| } | |
| } | |
| exit (0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bwlimit: 40960 | |
| ionice: 8 | |
| pigz: 3 | |
| script: /etc/vzdump-hook-script.pl | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment