|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /scripts/ |
Upload File : |
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - killvhost Copyright(c) 2013 cPanel, Inc.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
use strict;
use Cpanel::Locale ();
use Cpanel::HttpUtils::ApRestart ();
use Cpanel::HttpUtils::Domain ();
use Cpanel::HttpUtils::Config::Apache ();
use Cpanel::HttpUtils::SSL ();
my @domains = @ARGV;
die "Please provide one or more domains.\n" if !@domains;
my $locale = Cpanel::Locale->get_handle();
my $transaction = Cpanel::HttpUtils::Config::Apache->new();
my @removed;
for my $domain (@domains) {
my $real_domain = Cpanel::HttpUtils::Domain::findAliasMainServer( $domain, $transaction->_get_apache_conf_datastore_obj()->{'data'} );
next if !$real_domain;
my ( $remove_ok, $removed_ar ) = $transaction->remove_vhosts_by_name($real_domain);
die $removed_ar if !$remove_ok;
push @removed, @$removed_ar;
}
if (@removed) {
my ( $result, $msg ) = $transaction->save();
die $msg if !$result;
( $result, $msg ) = $transaction->close();
die $msg if !$result;
Cpanel::HttpUtils::ApRestart::bgsafeaprestart();
print $locale->maketext( 'You have successfully removed non-SSL virtual hosts for the following domains: [join,~, ,_1]”.', [ map { $_->{'servername'} } @removed ] );
}
else {
$transaction->abort();
print $locale->maketext('The given domains do not have any non-SSL virtual hosts to remove.');
}
print "\n";
exit;