Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ShExBy/smshex_r.../opt/sharedra...
File: dcpumon.pl
#!/usr/bin/perl
[0] Fix | Delete
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
[1] Fix | Delete
if $running_under_some_shell;
[2] Fix | Delete
# this emulates #! processing on NIH machines.
[3] Fix | Delete
# (remove #! line above if indigestible)
[4] Fix | Delete
[5] Fix | Delete
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
[6] Fix | Delete
# process any FOO=bar switches
[7] Fix | Delete
[8] Fix | Delete
$, = ' '; # set output field separator
[9] Fix | Delete
$\ = "\n"; # set output record separator
[10] Fix | Delete
[11] Fix | Delete
my $DCPUMONVIEW="/usr/local/cpanel/bin/dcpumonview";
[12] Fix | Delete
#if ( ! -f $DCPUMONVIEW ) {
[13] Fix | Delete
# print "Can't find $DCPUMONVIEW!";
[14] Fix | Delete
# exit 1;
[15] Fix | Delete
#}
[16] Fix | Delete
my @DCPUMONDATA=`$DCPUMONVIEW`;
[17] Fix | Delete
#while (<@DCPUMONDATA>) {
[18] Fix | Delete
foreach (@DCPUMONDATA) {
[19] Fix | Delete
chomp; # strip record separator
[20] Fix | Delete
s/<[\/]t.>|<t.>|<t. bgcolor=#......>|<t. colspan=.>/ /g;
[21] Fix | Delete
#if (s/(root|mailnull|mailman|mysql|nobody)/$1 [system]/;
[22] Fix | Delete
#s/([a-z]) /$1 /;
[23] Fix | Delete
if (! /Top( |\t)+Process/ && ! /^$/ && ! /^( |\t)+$/ )
[24] Fix | Delete
{
[25] Fix | Delete
[26] Fix | Delete
s/(root|mailnull|mailman|mysql|nobody|jabber|daemon)/$1 [system]/;
[27] Fix | Delete
#if (! /[a-z]+[0-9]+/) { s/([a-z]+ )/$1 [system]/; }
[28] Fix | Delete
s/(32[0-9][0-9][0-9])/$1 [unknown]/;
[29] Fix | Delete
#print $_;
[30] Fix | Delete
#my ($count)=$_=~y/\s/ /;
[31] Fix | Delete
#print $count+1;
[32] Fix | Delete
my ($user, $site, $cpu,$mem,$mysql) = split(' ',$_,-1);
[33] Fix | Delete
#if ($site =~ / +/){ $site="[unknown]"; }
[34] Fix | Delete
#$site="foo";
[35] Fix | Delete
printf("%25s %35s %10s %10s %10s \n", $user, $site, $cpu,$mem,$mysql );
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function