作者/来源:yixinu.com
栏目:运维/编程
日期:2021-01-20 11:13:54
#!/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
case "$1" in
start)
cd $PATH1
if [ -f "$file" ]; then
mv $file "$file.1"
fi
$EXEC1 start $PORT1
;;
stop)
cd $PATH1
$EXEC1 stop $PORT1
;;
restart)
cd $PATH1
$EXEC1 stop $PORT1
echo "stopping……"
sleep 1;
if [ -f "$file" ]; then
mv $file "$file.1"
fi
echo "starting……"
$EXEC1 start $PORT1
;;
*)
echo "service ts start|stop|restart"
;;
esac
### 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"
PORT1=9911
case "$1" in
start)
cd $PATH1
if [ -f "$file" ]; then
mv $file "$file.1"
fi
$EXEC1 start $PORT1
;;
stop)
cd $PATH1
$EXEC1 stop $PORT1
;;
restart)
cd $PATH1
$EXEC1 stop $PORT1
echo "stopping……"
sleep 1;
if [ -f "$file" ]; then
mv $file "$file.1"
fi
echo "starting……"
$EXEC1 start $PORT1
;;
*)
echo "service ts start|stop|restart"
;;
esac