1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
|
|
3 |
use strict; |
use strict; |
4 |
use Shell qw/rsync vzlist lvcreate mount umount lvremove which ssync lvdisplay mke2fs/; |
use Shell qw/rsync vzlist lvcreate mount umount lvremove which lvdisplay mke2fs/; |
5 |
|
|
6 |
my $vz = '/vz'; |
my $vz = '/vz'; |
7 |
my $conf = '/etc/vz/conf'; |
my $conf = '/etc/vz/conf'; |
44 |
|
|
45 |
sub copy_files { |
sub copy_files { |
46 |
my ( $from, $to ) = @_; |
my ( $from, $to ) = @_; |
47 |
if ( which('ssync') ) { |
warn "rsync $from -> $to\n"; |
48 |
warn "ssync $from -> $to\n"; |
rsync('-raSHAD', "$from/", "$to/" ); |
|
ssync(qw{--log-mode file --log-path /dev/null},'-f',$from,'-t',$to); |
|
|
} else { |
|
|
warn "rsync $from -> $to\n"; |
|
|
rsync('-ra', "$from/", "$to/" ); |
|
|
} |
|
49 |
} |
} |
50 |
|
|
51 |
if ( $vz_lv ) { |
if ( $vz_lv ) { |
104 |
|
|
105 |
print "Cleanup\n"; |
print "Cleanup\n"; |
106 |
|
|
107 |
umount( "$vz_lv_path/$clone" ); |
#umount( "$vz_lv_path/$clone" ); |
108 |
umount( "$vz_lv_path/$snap" ); |
umount( "$vz_lv_path/$snap" ); |
109 |
|
|
110 |
lvremove( '-f', "$vz_lv_path/$snap" ); |
lvremove( '-f', "$vz_lv_path/$snap" ); |