-
Notifications
You must be signed in to change notification settings - Fork 13
/
subweb.sh
executable file
·35 lines (34 loc) · 1.3 KB
/
subweb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /bin/sh
echo "-----------------------------------Start-------------------------------------"
chmod 777 /root/subweb/config/subconverter
while true
do
proc_name="subconverter" #subconverter进程名
proc_num() #查询进程数量
{
num=`ps -ef | grep $proc_name | grep -v grep | wc -l`
return $num
}
proc_num
number=$? #获取进程数量
if [ $number -eq 0 ] #如果进程数量为0
then #重新启动服务器,或者扩展其它内容。
cd /root/subweb/config
./subconverter &
fi
proc_name="api.py" #api.py进程名
proc_num() #查询进程数量
{
num=`ps -ef | grep $proc_name | grep -v grep | wc -l`
return $num
}
proc_num
number=$? #获取进程数量
if [ $number -eq 0 ] #如果进程数量为0
then #重新启动服务器,或者扩展其它内容。
python3 /root/subweb/api.py & #运行web服务
fi
sleep 60s
echo "------------------------------------Sucess----------------------------------------"
done
echo "------------------------------------WEB----------------------------------------"