/[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

Annotation of /trunk/vz-remove.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 40 - (hide annotations)
Fri Feb 8 23:02:25 2008 UTC (15 years ago) by dpavlin
File MIME type: text/plain
File size: 657 byte(s)
- added new common functions
- export $vz_root and $vz_conf
1 dpavlin 36 #!/usr/bin/perl -w
2    
3     use strict;
4 dpavlin 37 use Shell qw/rm vzlist vzctl/;
5 dpavlin 36
6 dpavlin 40 use lib 'lib';
7     use VZ;
8     check_root;
9 dpavlin 36
10     my $VEID = shift @ARGV;
11    
12 dpavlin 40 die "Usage: $0 VEID\n\n", join("\n",vzlist_configs()),"\n" unless $VEID;
13 dpavlin 36
14 dpavlin 40 my $c = "$vz_conf/$VEID.conf";
15 dpavlin 36 if ( -e $c ) {
16 dpavlin 37 vzctl('stop', $VEID);
17 dpavlin 36 unlink $c || die "can't remove $c: $!";
18 dpavlin 40 warn "# removed $c\n";
19 dpavlin 36 } else {
20     warn "WARNING: configuration file $c doesn't exist\n";
21     }
22    
23     foreach my $p ( qw/root private/ ) {
24 dpavlin 40 my $c = "$vz_root/$p/$VEID";
25 dpavlin 36 if ( -e $c ) {
26     rm('-Rf', $c);
27     die "can't remove $c: $!" if -e $c;
28 dpavlin 40 warn "# removed $c\n";
29 dpavlin 36 } 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