27 |
our $vz_root = '/vz'; |
our $vz_root = '/vz'; |
28 |
our $vz_conf = '/etc/vz/conf'; |
our $vz_conf = '/etc/vz/conf'; |
29 |
|
|
30 |
|
$vz_root = '/var/lib/vz' if ! -e $vz_root && -e '/var/lib/vz'; |
31 |
|
|
32 |
=head1 NAME |
=head1 NAME |
33 |
|
|
34 |
VZ - helper functions for VZ tools |
VZ - helper functions for VZ tools |
90 |
open( my $cfgs, 'find /etc/vz/conf -maxdepth 1 -name "*.conf" |' ) || die "can't run find: $!"; |
open( my $cfgs, 'find /etc/vz/conf -maxdepth 1 -name "*.conf" |' ) || die "can't run find: $!"; |
91 |
while(<$cfgs>) { |
while(<$cfgs>) { |
92 |
chomp; |
chomp; |
93 |
if ( m#^.+/(\d+)\.conf$# ) { |
if ( m{^.+/(\d+)\.conf$} ) { |
94 |
if ( -d "$vz_root/private/$1" ) { |
if ( -d "$vz_root/private/$1" ) { |
95 |
push @c, $1; |
push @c, $1; |
96 |
} else { |
} else { |
112 |
sub runscript { |
sub runscript { |
113 |
my ( $veid, $path ) = @_; |
my ( $veid, $path ) = @_; |
114 |
|
|
115 |
open(my $fh, $path) || die "can't open $path: $!"; |
if ( open(my $fh, $path) ) { |
116 |
while(<$fh>) { |
while(<$fh>) { |
117 |
chomp; |
chomp; |
118 |
next if (m/^\s*$/); |
next if (m/^\s*$/); |
119 |
if (/^#\s+(.+)$/) { |
if (/^#\s+(.+)$/) { |
120 |
warn ">> $1\n"; |
warn ">> $1\n"; |
121 |
} else { |
} else { |
122 |
vzctl('exec', $veid, $_); |
vzctl('exec', $veid, $_); |
123 |
|
} |
124 |
} |
} |
125 |
|
} else { |
126 |
|
warn "can't open $path: $!"; |
127 |
} |
} |
128 |
} |
} |
129 |
|
|
158 |
|
|
159 |
|
|
160 |
my $output; |
my $output; |
161 |
|
$output = {} if defined $args->{hash}; |
162 |
|
|
163 |
if ( ! @vzlist_fields ) { |
if ( ! @vzlist_fields ) { |
164 |
open(my $vzlist, 'vzlist -L |') || die "can't start vzlist -L: $!"; |
open(my $vzlist, 'vzlist -L |') || die "can't start vzlist -L: $!"; |