3 # Delete an apache virtual server by server name
5 @ARGV == 1 || die "usage: remove_vserv.pl <servername>";
8 $ENV{'WEBMIN_CONFIG'} = "/etc/webmin";
9 $ENV{'WEBMIN_VAR'} = "/var/webmin";
10 if ($0 =~ /^(.*\/)[^\/]+$/) {
13 require './apache-lib.pl';
14 $module_name eq 'apache' || die "Command must be run with full path";
15 $conf = &get_config();
16 @virts = &find_directive_struct("VirtualHost", $conf);
18 local $sn = &find_directive("ServerName", $v->{'members'});
19 if ($sn eq $ARGV[0]) {
20 # Found the one to delete ..
21 &save_directive_struct($v, undef, $conf, $conf);
23 print "Delete virtual server from $v->{'file'} at line ",
24 ($v->{'line'}+1),"\n";
28 print "Failed to find virtual server\n";