Suse init.d 服务启动脚本写法

#!/bin/sh
### 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


上一篇:怎么提升搜索引擎对网站的权重?


下一篇:Java项目:个人博客系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)