5/16/06, John Madden <jmadden (AT) ivytech (DOT) eduwrote:
Mon, 2006-05-15 at 22:04 -0400, matthew sporleder wrote:
You wait for the pid to go away before moving on with the shutdown.
FWIW, the 'stop' stanza of my /etc/init.d/slapd is below. It sends a
-INT and keeps trying, preventing the box from going down until slapd's
done.
'stop')
if [ -f /var/run/slapd/slapd.pid ]
then
pid=`cat /var/run/slapd/slapd.pid`
res=`ps -efl | grep slapd | grep $pid`
if [ "$res" != "" ]
then
kill -INT `cat /var/run/slapd/slapd.pid`
echo "-INT sent to slapd"
sleep 1
res=`ps -efl | grep slapd | grep $pid`
while [ "$res" != "" ]
do
echo "slapd still running, waiting"
sleep 1
res=`ps -efl | grep slapd | grep $pid`
done
echo "slapd stopped"
else
echo "PID file found, but slapd not running"
fi
else
echo "slapd not running"
fi
;;
*)
This all really depends on your S vendor's implementation of
'shutdown' and/or 'init'. Since you're using linux, you can probably
look it up, but this goes beyond the scope of this list.