test
This commit is contained in:
parent
ef1116dff2
commit
94f44d3300
10
MQTT.py
10
MQTT.py
|
@ -18,16 +18,16 @@ def on_connect(client, userdata, flags, rc):
|
|||
def on_message(client, userdata, msg):
|
||||
data = json.loads(msg.payload.decode('utf-8'))["msg"]
|
||||
if data == "push_stream":
|
||||
# TODO 启动推流视频
|
||||
# 启动推流视频
|
||||
push_stream()
|
||||
elif data == "close_stream":
|
||||
# TODO 关闭推流视频
|
||||
# 关闭推流视频
|
||||
close_stream()
|
||||
elif data == "exec":
|
||||
# TODO 执行命令 更新配置
|
||||
# 执行命令
|
||||
exec_sh()
|
||||
elif data == "update":
|
||||
# TODO git更新项目
|
||||
# git更新项目和配置文件
|
||||
update()
|
||||
else:
|
||||
client.publish('conn_error', payload='No Such Type', qos=0)
|
||||
|
@ -40,6 +40,6 @@ if __name__ == '__main__':
|
|||
client.on_connect = on_connect
|
||||
client.on_message = on_message
|
||||
# Establish a connection
|
||||
client.connect('ceshi-mqtt.lihaink.cn', 1883)
|
||||
client.connect('127.0.0.1', 1883)
|
||||
# Publish a message
|
||||
client.loop_forever()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[program:mqtt]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/home/lihai/anaconda3/envs/chatchat/bin/python MQTT.py
|
||||
directory=/home/lihai//PycharmProjects/pythonProject/lot_manager
|
||||
command=/home/lihai//anaconda3/envs/chatchat/bin/python MQTT.py
|
||||
user=lihai
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
[program:test]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/home/lihai/anaconda3/envs/chatchat/bin/python test.py
|
||||
user=lihai
|
||||
;是否随开机自启 或者reload自启动
|
||||
autostart=false
|
||||
;失败重启
|
||||
autorestart=true
|
||||
;重启次数
|
||||
restart_times=3
|
||||
redirect_stderr=true
|
||||
stopsignal=TERM
|
||||
stopasgroup=True
|
|
@ -0,0 +1,10 @@
|
|||
[program:test2]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/home/lihai/anaconda3/envs/chatchat/bin/python test.py
|
||||
user=lihai
|
||||
autostart=false
|
||||
autorestart=true
|
||||
restart_times=3
|
||||
redirect_stderr=true
|
||||
stopsignal=TERM
|
||||
stopasgroup=True
|
|
@ -1,6 +1,6 @@
|
|||
[program:push_stream]
|
||||
directory=/home/lihai/PycharmProjects/pythonProject/lot_manager
|
||||
command=/usr/bin/ffmpeg -rtsp_transport tcp -re -i rtsp://admin:123456@192.168.0.123:554/mpeg4 -c:v copy -c:a aac -preset ultrafast -r 20 -flvflags no_duration_filesize -f rtsp -rtsp_transport tcp rstp://47.108.186.87:554/live/test9
|
||||
command=/usr/bin/ffmpeg -rtsp_transport tcp -re -i rtsp://admin:123456@192.168.0.123:554/mpeg4 -c:v copy -c:a aac -preset ultrafast -r 20 -flvflags no_duration_filesize -f rtsp -rtsp_transport tcp rstp://127.0.0.1:554/live/test
|
||||
user=lihai
|
||||
autostart=true
|
||||
autorestart=true
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
#复制配置文件
|
||||
cp -r conf/*.conf /etc/supervisor/conf.d/
|
||||
set -e
|
||||
cp -r reload_conf/*.conf /etc/supervisor/conf.d/
|
||||
# 重启所有配置
|
||||
supervisorctl reload
|
||||
# 推流不启动
|
||||
supervisorctl stop push_stream
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
supervisorctl start push_stream
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/bash
|
||||
supervisorctl stop push_stream
|
||||
set -e
|
||||
|
||||
supervisorctl stop test
|
||||
|
|
Loading…
Reference in New Issue