代码拉取完成,页面将自动刷新
#!/bin/bash
waiting=0
check_server() {
url=http://localhost:7860
response_code=$(curl -o /dev/null -s -w "%{http_code}" --connect-timeout 2 $url)
[[ $response_code -ne 200 ]] && {
return 0
}
return 1
}
while [ 1 ]
do
# periodically clear the /tmp directory for files created > 30 mins ago so it doesn't fill up
sudo find /tmp -type f -amin +30 -delete
check_server
if [[ $? -ne 1 ]]
then
if [[ $waiting -eq 0 ]]
then
waiting=1
echo "Restarting"
pkill -9 python
#sudo lsof -t /dev/accel0 | xargs kill -9
sleep 5
mv log.txt log_`date +%Y%m%d%H%M%S`
TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD=10000000000 python ./app.py &> log.txt &
else
echo "Waiting for restart"
fi
else
if [[ $waiting -eq 1 ]]
then
waiting=0
echo "Restarted"
fi
fi
sleep 10
done
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。