HOME 生活记录运维/编程
作者/来源:yixinu.com
栏目:运维/编程
日期:2021-01-20 11:13:00
#!/bin/bash


### BEGIN INIT INFO
# Provides:      ser1
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts ser1 server
# Description:       starts ts using start-stop-daemon
### END INIT INFO


EXEC1=./ser1

PATH1=/opt/ser1/
file="./err.log"

case "$1" in
    start)
        cd $PATH1
        if [ -f "$file" ]; then
            mv $file "$file.1"
        fi
        $EXEC1 start 8082
    ;;
    stop)
        cd $PATH1
        $EXEC1 stop 8082
    ;;
    restart)
        cd $PATH1
        $EXEC1 stop 8082
        echo "stopping……"
        sleep 1;
        if [ -f "$file" ]; then
            mv $file "$file.1"
        fi
    echo "starting……"
        $EXEC1 start 8082
    ;;
    *)
    echo "service ts start|stop|restart"
    ;;
esac

分享到:

Copyright © 2013-2014 yixinu.com 湘ICP备14004402号

QQ:316686606  Email: 316686606@qq.com