This commit is contained in:
xyj 2024-03-02 10:47:31 +08:00
parent ad804df242
commit 143d6fc3f9
3 changed files with 25 additions and 6 deletions

View File

@ -5,6 +5,7 @@
</component>
<component name="ChangeListManager">
<list default="true" id="6fcbdb26-1795-4695-b353-57b405f1e401" name="Changes" comment="update">
<change afterPath="$PROJECT_DIR$/conf/common/forever.conf" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/forever.py" beforeDir="false" afterPath="$PROJECT_DIR$/forever.py" afterDir="false" />
</list>
@ -259,7 +260,15 @@
<option name="project" value="LOCAL" />
<updated>1709347113656</updated>
</task>
<option name="localTasksCounter" value="10" />
<task id="LOCAL-00010" summary="update">
<option name="closed" value="true" />
<created>1709347345026</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1709347345026</updated>
</task>
<option name="localTasksCounter" value="11" />
<servers />
</component>
<component name="UnknownFeatures">

7
conf/common/forever.conf Normal file
View File

@ -0,0 +1,7 @@
[program:push_stream]
directory=/home/pi/agri_xumu
command=/usr/bin/python forever.py
user=pi
autostart=true
autorestart=true
redirect_stderr=true

View File

@ -9,8 +9,11 @@ def job():
# 每半小时执行一次
schedule.every(1).minutes.do(job)
schedule.every(10).minutes.do(job)
try:
while True:
schedule.run_pending()
time.sleep(1)
except Exception as e:
print(e)
subprocess.Popen(['supervisorctl reload'], shell=True)