在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
linux环境:ubuntu 复制代码 代码如下: #! /bin/sh # Provides: server.sh # Default-Start: 2 3 4 5 # Short-Description: server testing... EXEC_PATH=/home/huangmin/cdev/project EXEC=server PID_FILE=/var/run/server.sh.pid DAEMON=/home/huangmin/cdev/project/server if ! [ -x $EXEC_PATH/$EXEC ]; then echo "ERROR:$EXEC_PATH/$EXEC not found ..." exit 1 fi stop() { echo "Stopping $EXEC ..." killall $DAEMON >/dev/null rm -f $PID_FILE sleep 1 echo "Shutting down $EXEC: [OK]" } start() { echo "Starting $EXEC ..." $DAEMON >/dev/null pidof $EXEC > $PID_FILE sleep 1 echo "Starting $EXEC: [OK]" } restart() { stop start } case "$1" in start) start stop) stop restart) restart status) echo "Status Here" *) echo "Usage: service $EXEC {start|stop|restart|status}" exit 1 esac exit $? /home/huangmin/cdev/project/server是我们需要的作为系统服务的程序。 |
请发表评论