MENU

守护进程1

September 21, 2018 • Read: 3689 • bash脚本

需要做一个守护进程,每3分钟会检测一次进程是否启动

重点:
程序是php程序,需要以root用户启动

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
ps -fe|grep think |grep -v grep
if [ $? -ne 0 ];
then
sudo -i /www/server/php/70/bin/php /www/wwwroot/gwms/think download >> /www/wwwlogs/think.log 2>&1
fi
echo "----------------------------------------------------------------------------"
endDate=`date +"%Y-%m-%d %H:%M:%S"`
echo "★[$endDate] Successful"
echo "----------------------------------------------------------------------------"

大神的脚本也需要做个守护进程

把socket转http

兼总条贯 知至知终

最后编辑于: June 24, 2019