/[vz-tools]/trunk/vz-remove.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/vz-remove.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (show annotations)
Fri Feb 8 23:53:52 2008 UTC (16 years, 1 month ago) by dpavlin
File MIME type: text/plain
File size: 685 byte(s)
stop VE only if started
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Shell qw/rm/;
5
6 use lib 'lib';
7 use VZ;
8 check_root;
9
10 my $VEID = shift @ARGV;
11
12 die "Usage: $0 VEID\n\n", join("\n",conf_veids()),"\n" unless $VEID;
13
14 my $c = "$vz_conf/$VEID.conf";
15 if ( -e $c ) {
16 vzctl('stop', $VEID) if defined( vzlist( hash => 1 )->{ $VEID } );
17 unlink $c || die "can't remove $c: $!";
18 warn "# removed $c\n";
19 } else {
20 warn "WARNING: configuration file $c doesn't exist\n";
21 }
22
23 foreach my $p ( qw/root private/ ) {
24 my $c = "$vz_root/$p/$VEID";
25 if ( -e $c ) {
26 rm('-Rf', $c);
27 die "can't remove $c: $!" if -e $c;
28 warn "# removed $c\n";
29 } else {
30 warn "WARNING: directory $c doesn't exist\n";
31 }
32 }
33
34 print "OK: $VEID removed\n";

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26