This commit is contained in:
liwei1dao 2022-07-22 15:30:13 +08:00
parent 477bfd265a
commit fe39bf30c1
3 changed files with 15 additions and 6 deletions

0
bin/start.sh Normal file → Executable file
View File

2
bin/stop.sh Normal file → Executable file
View File

@ -2,4 +2,4 @@
./stup.sh stop mainte
./stup.sh stop worker_1
./stup.sh stop worker_1

View File

@ -1,10 +1,14 @@
#!/bin/sh
SERVICE=$2
CMD="./$2 -conf $3"
CMD="./$3 -conf $4"
start(){
echo "starting..."
nohup $CMD > /dev/null 2>&1 &
echo "starting $SERVICE..."
num=`ps -ef | grep $SERVICE | grep -v grep | wc -l`
if [ $num -eq 0 ]
then
nohup $CMD > /dev/null 2>&1 &
# nohup $CMD >output.log 2>&1 &
if [ $? -ne 0 ]
then
@ -14,9 +18,14 @@
echo $! > $SERVICE.pid
echo "start success"
fi
else
echo "$SERVICE is already running"
fi
}
stop(){
echo "stopping..."
echo "stopping $SERVICE..."
kill -9 `cat $SERVICE.pid`
if [ $? -ne 0 ]
then
@ -47,4 +56,4 @@
*) echo "Usage: $0 {start|stop|restart|status}" ;;
esac
exit 0
exit 0