|
@@ -1,4 +1,16 @@
|
1
|
1
|
#!/bin/sh
|
2
|
2
|
clear
|
3
|
|
-/opt/mqtt_sniffer/venv/bin/python /opt/mqtt_sniffer/mqtt_sniffer.py -f mqtt.home
|
|
3
|
+
|
|
4
|
+#!/bin/sh
|
|
5
|
+#
|
|
6
|
+
|
|
7
|
+for s in $(tmux list-sessions -F '#{session_name}'); do
|
|
8
|
+ p=$(tmux list-panes -F '#{pane_tty}' -t "$s")
|
|
9
|
+ if [ "$p" = "$(tty)" ]; then
|
|
10
|
+ # Session already running
|
|
11
|
+ exit 0
|
|
12
|
+ fi
|
|
13
|
+done
|
|
14
|
+
|
|
15
|
+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"
|
4
|
16
|
|