You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
490 B

2 years ago
#!/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