代码拉取完成,页面将自动刷新
同步操作将从 jackyzux/PhaService 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env bash
SOURCE="$0"
while [ -h "$SOURCE" ]; do
BASE_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$BASE_DIR/$SOURCE"
done
BASE_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
ulimit -c unlimited
APP_NAME="{ PhaServie StdWebSocketServer }"
MAIN_SCRIPT="$BASE_DIR/sys/StdWebSocketServer/initialize.php"
PID_FILE="${BASE_DIR}/var/pid/std_web_socket_server.pid"
LOG_DIR="${BASE_DIR}/var/log"
STR_DATE=`date +%Y%m%d`
LOG_FILE="${LOG_DIR}/std_web_socket_server_${STR_DATE}_$$.log"
# Check running
FUNC_CHK_RUNNING(){
if [ -f "${PID_FILE}" ]; then
MASTER_PID=`cat ${PID_FILE}`
if [ -d "/proc/${MASTER_PID}" ]; then
return 1
fi
fi
return 0
}
# Start
FUNC_START(){
FUNC_CHK_RUNNING
if [ "$?" = "1" ]; then
echo "[START] RUNNING..., PROCESS_ID:${MASTER_PID}"
return
fi
nohup php "${MAIN_SCRIPT}" start ${LOG_FILE} > ${LOG_FILE} 2>&1 &
echo "[START] [$$] SUCCESS"
}
# Status
FUNC_STATUS(){
FUNC_CHK_RUNNING
if [ "$?" = "1" ]; then
echo "[STATUS] RUNNING..., PROCESS_ID:${MASTER_PID}"
return 1
else
echo "[STATUS] THE SERVICE NOT RUNNING."
return 0
fi
}
# Reload
FUNC_RELOAD(){
FUNC_CHK_RUNNING
if [ "$?" = "1" ]; then
kill -USR1 ${MASTER_PID}
return 1
else
echo "[RELOAD] THE SERVICE NOT RUNNING."
return 0
fi
}
# Restart
FUNC_RESTART(){
FUNC_STOP
FUNC_START
}
# Stop
FUNC_STOP(){
FUNC_CHK_RUNNING
if [ "$?" = "1" ]; then
kill -15 ${MASTER_PID}
if [ "$?" = "0" ]; then
echo -e "[STOP] PROCESS_ID:${MASTER_PID}\c"
while [ -d "/proc/${MASTER_PID}" ]
do
echo -e ".\c"
sleep 0.1
done
echo "[STOP] SUCCESS"
return 1
else
echo "[STOP] ERROR, PROCESS_ID:${MASTER_PID}"
return 0
fi
else
echo "[STOP] THE SERVICE NOT RUNNING."
return 1
fi
}
# Kill
FUNC_KILL(){
FUNC_CHK_RUNNING
if [ "$?" = "1" ]; then
kill -9 ${MASTER_PID}
if [ "$?" = "0" ]; then
echo -e "[KILL] ${MASTER_PID}\c"
while [ -d "/proc/${MASTER_PID}" ]
do
echo -e ".\c"
sleep 0.1
done
echo "[KILL] SUCCESS"
return 1
else
echo "[KILL] ERROR, PROCESS_ID:${MASTER_PID} "
return 0
fi
else
echo "[KILL] THE SERVICE NOT RUNNING."
return 1
fi
}
if [ ! -d "${LOG_DIR}" ]; then
mkdir -p ${LOG_DIR}
fi
case "$1" in
"start") FUNC_START ;;
"status") FUNC_STATUS ;;
"reload") FUNC_RELOAD ;;
"restart") FUNC_RESTART ;;
"stop") FUNC_STOP ;;
"kill") FUNC_KILL ;;
*)
echo " "
echo "┌───────────────────────────────────────────────────────────────────────────────┐"
echo "│ │"
echo "│ ${APP_NAME} │"
echo "│ │"
echo "├─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─┤"
echo "│ https://www.qhbit.cn <jacky.ju@qq.com> │"
echo "├───────────────────────────────────────────────────────────────────────────────┤"
echo "│ Usage: │"
echo "│ ./$(basename $0) {start|status|restart|reload|stop|kill} │"
echo "└───────────────────────────────────────────────────────────────────────────────┘"
;;
esac
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。