A year ago I wrote a little bash-script to use as a watchdog for my ASSP’s.
Whenever I have a buggy or ill-responding ASSP-script, it is easily identified 
by its occasional restarting (of which I get an email).
It is working quite good, but I want to improve it.
 
The watchdog uses “service <assp-service> start” and “service <assp-service> 
stop” to control the process.
Sometimes, on a high-load server, the command “service <assp-service> stop” is 
not able to stop the process.
That’s why I want to use “kill -9” to remove the process from memory.
Is this good practice or bad practice?
 
Furthermore I want to know which script to modify.
I can modify my watchdog, the “init.d script” or the “stop” script.
The easiest place to modify was the “stop” script, which I did.
Anyone having tips or comments?
 
# cd /opt/ASSP/
# cat stop
#!/bin/sh
if [ "$1" = "" ]
 then
  BASE=/opt/ASSP;
 else
  BASE=$1;
fi
export BASE
echo Stopping ASSP Anti-SPAM Proxy server in $BASE
pidfile=$BASE/pid
kill `cat $pidfile`
 
# wait for ASSP to quit gracefully
tries=""
while [ -e $pidfile ]; do
  if [ "x$tries" == "x......." ]; then
    break
  fi
  sleep 2
  tries=".$tries"
done
if [ -e $pidfile ]; then
  echo "ASSP is still running, I will remove it from memory"
  kill -9 `cat $pidfile`
fi
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to