#!/bin/bash
# 演出赛事票码队列
# zhangcunchao
phpExecBinPath=/home/pubsrv/php-7.1.10/bin/php
phpExecLogPath=/home/mosh/console-log
# 队列进程名,多进程请使用父进程名,注意进程名的唯一性
proccessName=Ticket-KafkaEventCommand-manger
BASE_PATH=`dirname $0`"/"
cd $BASE_PATH
if [ ! -n "$1" ];then
echo "Usage: $0 {start|stop|restart|reload}";
exit 1;
fi
SPID=`ps w -C php|grep $proccessName | awk '{print $1}'`
case $1 in
start)
nohup $phpExecBinPath ../artisan KafkaEventCommand:queue --num=3 >> $phpExecLogPath/$proccessName.nohup 2>&1 &
echo "启动成功!日志输出到:"$phpExecLogPath/$proccessName.nohup;
exit $?;
;;
stop)
if [ ! -n "$SPID" ];then
echo $proccessName"进程不存在";
exit 1;
fi
kill -s SIGTERM $SPID
echo $proccessName"进程关闭";
exit $?;
;;
reload)
if [ ! -n "$SPID" ];then
echo $proccessName"进程不存在";
exit 1;
fi
kill -s SIGUSR1 $SPID
echo $proccessName"平滑重启信号发送完成";
exit $?;
;;
restart)
if [ ! -n "$SPID" ];then
echo $proccessName"进程不存在";
else
kill -s SIGTERM $SPID
echo $proccessName"进程关闭";
sleep 3s;
fi
nohup $phpExecBinPath ../artisan KafkaEventCommand:queue --num=3 >> $phpExecLogPath/$proccessName.nohup 2>&1 &
echo "重启成功!日志输出到:"$phpExecLogPath/$proccessName.nohup;
exit $?;
;;
*)
echo "Usage: $0 {start|stop|restart|reload}";
exit 1;
esac
本文档使用 521Wiki 发布