### BEGIN INIT INFO
# Provides:processA
# Required-Start:
# Should-Start: $ALL
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start processA Server
### END INIT INFO
case $1 in
start)
echo -n "Starting processA Server: "
perl /opt/process_server.pl&
echo "ok"
;;
stop)
echo -n "Stoping processA Server: "
PIDLIST=`ps -ef|grep 'processA'|grep -v grep|awk '{print $2}'`;
echo "$PIDLIST";
while [ "${PIDLIST}" ];
do
PIDLIST=`ps -ef|grep 'processA'|grep -v grep|awk '{print $2}'`;
for pid in ${PIDLIST}
{
kill -9 $pid;
echo "KILL $pid";
}
done
echo "ok"
;;
restart)
echo -n "Restarting processA Server: "
$0 stop
$0 start
echo "ok"
;;
*)
# Print help
echo "Usage: $0 {start|stop|restart}" 1>&2
exit 1
;;
esac
exit 0
本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/926793