[BlueOnyx:09376] Re: admin errors python

Ken - Precision Web Hosting, Inc kenlists at precisionweb.net
Thu Jan 12 14:06:53 -05 2012


----- Original Message ----- 
From: Steffan

It happens many times that on several servers the siteadmin cant be reached
Restarting admserv gives a error on port 81
Python is taking port 81
So killing it will restart admserv but why happens this
And what to do to resolve this

tcp        0      0 :::81                       :::* 
LISTEN      27657/python

With regards

Steffan
<<



Steffan

Below is the  script I run every few minutes.
It checks the admserv  and restarts if necessary.
It also checks to see if port 444 is taken and kills any processes using 
that port.

It could be modified to also check and kill processes that steal port 81.

#!/usr/bin/perl
##################################################################
# checks the admserv if necessary

$running = "no";
$processtokill = "nothing";

$pscount =`ps auxwwwww | grep httpd | grep admsrv | grep -v grep | grep -v 
defunct -c `;

if ( $pscount > 1 ) {
$running = "yes";
}


if ($running eq "no") {
print "admserv problem - restart it \n";
system ("/etc/rc.d/init.d/admserv stop");
sleep (5);

$fuser =`/sbin/fuser 444/tcp`;
chomp ($fuser);
($prev0, $processtokill) = split(/tcp:/,$fuser);

print "The /fuser of 444 is $fuser \n";
if ($processtokill =~ /\d/){
system ("kill -9 $processtokill");
print "I killed $processtokill \n";
}

system ("/etc/rc.d/init.d/admserv start");

print "The ps is $aps \n";
print "The /fuser of 444 is $fuser \n";
print "444 process $processtokill \n";
system ("touch $filename");
}

?

#############################################

?

?

----

Ken Marcus

Precision Web Hosting, Inc.

http://www.precisionweb.net








More information about the Blueonyx mailing list