update
This commit is contained in:
20
SARA/check_running.py
Normal file
20
SARA/check_running.py
Normal file
@@ -0,0 +1,20 @@
|
||||
'''
|
||||
Check if the main loop is running
|
||||
/usr/bin/python3 /var/www/nebuleair_pro_4g/tests/check_running.py
|
||||
'''
|
||||
import psutil
|
||||
import subprocess
|
||||
|
||||
def is_script_running(script_name):
|
||||
"""Check if a given Python script is running."""
|
||||
for process in psutil.process_iter(['pid', 'cmdline']):
|
||||
if process.info['cmdline'] and script_name in " ".join(process.info['cmdline']):
|
||||
return True # Script is running
|
||||
return False # Script is not running
|
||||
|
||||
script_to_check = "/var/www/nebuleair_pro_4g/loop/SARA_send_data_v2.py"
|
||||
|
||||
if is_script_running(script_to_check):
|
||||
print(f"{script_to_check} is still running.❌❌❌")
|
||||
else:
|
||||
print(f"{script_to_check} is NOT running.✅✅✅")
|
||||
@@ -6,6 +6,8 @@ ex 2 (turn on blue light):
|
||||
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+UGPIOC=16,2 2
|
||||
ex 3 (reconnect network)
|
||||
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+COPS=1,2,20801 20
|
||||
ex 4 (get HTTP Profiles)
|
||||
python3 /var/www/nebuleair_pro_4g/SARA/sara.py ttyAMA2 AT+UHTTP? 2
|
||||
|
||||
'''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user