This commit is contained in:
xyj 2023-12-28 16:54:53 +08:00
parent a0e4dcac5b
commit de7f10bb0e
5 changed files with 28 additions and 9 deletions

View File

@ -1,5 +1,9 @@
# 每天00分执行
0 0 * * * /usr/bin/python /home/pi/lot_manager/delete_lot_data_3_days.py
# 每天0800分执行
0 8 * * * sudo /usr/bin/python /home/pi/lot_manager/open_led.py
# 每天1800分执行
0 18 * * * sudo /usr/bin/python /home/pi/lot_manager/close_led.py
# 针对32G内存卡的定时额外加这个
# 每隔15分钟进行
*/15 * * * * /usr/bin/python /home/pi/lot_manager/delete_than20G.py

View File

@ -3,3 +3,7 @@
0 * * * * /usr/bin/bash /home/pi/lot_manager/bash/cron_delete_mp4.sh
# 每天00分执行
0 0 * * * /usr/bin/python /home/pi/lot_manager/delete_lot_data_3_days.py
# 每天0800分执行
0 8 * * * sudo /usr/bin/python /home/pi/lot_manager/open_led.py
# 每天1800分执行
0 18 * * * sudo /usr/bin/python /home/pi/lot_manager/close_led.py

8
cron_set.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -e
sudo crontab -l > cron.cron
echo "0 8 * * * sudo /usr/bin/python /home/pi/lot_manager/open_led.py" >> cron.cron
echo "0 18 * * * sudo /usr/bin/python /home/pi/lot_manager/close_led.py" >> cron.cron
sudo crontab cron.cron
sudo systemctl restart cron.service
sudo rm -rf cron.cron

View File

@ -10,11 +10,14 @@ git config --global user.name xyj
git config --global user.email 1090822794@qq.com
git config --global credential.helper store
echo "0 8 * * * sudo /usr/bin/python /home/pi/lot_manager/open_led.py" >> sudo crontab -
echo "0 18 * * * sudo /usr/bin/python /home/pi/lot_manager/close_led.py" >> sudo crontab -
cd /home/pi
git clone https://gitea.lihaink.cn/xyj/lot_manager.git
cd lot_manager
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
sudo pip install Adafruit-Blinka
sudo cp /etc/supervisor/supervisord.conf /etc/supervisor/supervisord.conf.bak
sudo cp conf/example/supervisord.conf /etc/supervisor/supervisord.conf
sudo chmod 777 /etc/supervisor/conf.d

View File

@ -192,11 +192,11 @@ def get_data():
'wind_direction': winddirection_data,
'create_time': int(time.time())
}
if sun_data < 2000:
subprocess.Popen(['sudo python /home/pi/lot_manager/close_led.py'], shell=True)
subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/stop_push_stream.sh'],shell=True)
else:
subprocess.Popen(['sudo python /home/pi/lot_manager/open_led.py'], shell=True)
# if sun_data < 2000:
# subprocess.Popen(['sudo python /home/pi/lot_manager/close_led.py'], shell=True)
# subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/stop_push_stream.sh'],shell=True)
# else:
# subprocess.Popen(['sudo python /home/pi/lot_manager/open_led.py'], shell=True)
t2 = LOT_DATA(**data)
client.publish(publish_topic, payload=json.dumps(data, ensure_ascii=False), qos=0)
add(t2)