mqtt_smarthome in tmux

This commit is contained in:
Dirk Alders 2023-11-08 12:46:39 +01:00
parent 33f1b70a13
commit d5f22f1a49

View File

@ -1,4 +1,16 @@
#!/bin/sh #!/bin/sh
clear clear
/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py -f mqtt.home
#!/bin/sh
#
for s in $(tmux list-sessions -F '#{session_name}'); do
p=$(tmux list-panes -F '#{pane_tty}' -t "$s")
if [ "$p" = "$(tty)" ]; then
# Session already running
exit 0
fi
done
tmux attach-session -t mqtt_smarthome || tmux new-session -s mqtt_smarthome "/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py -f mqtt.home"