This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#!/bin/bash
APP_NAME="/usr/local/frp/frpc"
BIN_PATH="/usr/local/frp"
#检测方法
checkStatus(){
pid=$(ps -ef |grep "$APP_NAME" |grep -v "grep" |awk '{print $2}');
#datetime=`date +%Y-%m-%d,%H:%m:%s`
datetime="`date`"
if [ -z "${pid}" ]; then
echo "$datetime ---- 开始启动服务$APP_NAME"
cd $BIN_PATH
nohup /usr/local/frp/frpc -c /usr/local/frp/frpc.ini &
else
echo "$datetime ---- 项目$APP_NAME已经启动,进程pid是${pid}!"
fi
}
checkStatus