-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmqtt.sh
52 lines (48 loc) · 1.91 KB
/
mqtt.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#[ "$(<.status)" = "online" ] && systemctl --user restart [email protected]
set -vx
avconcat() {
ffmpeg -i /mnt/birds/pivid/$(<.date).mkv \
-i /mnt/birds/audio/$(<.date).opus \
-map 0:0 -map 1:0 \
-c:v copy \
-af adelay=5000,aresample=async=1 -c:a libopus \
/mnt/nvme/pivid/$(<.date)_cat.mkv || return
mv -v /mnt/birds/audio/$(<.date).opus /mnt/birds/audio/$(<.date)_done.opus
mv -v /mnt/nvme/pivid/$(<.date)_cat.mkv /mnt/birds/pivid/$(<.date).mkv &
}
while read msg; do
echo "mqtt message: $msg" #| tee .status
case "$msg" in
off)
#systemctl --user stop [email protected]
#systemctl --user stop [email protected]
#systemctl --user stop [email protected]
#systemctl --user stop [email protected]
#systemctl --user stop streamutil@audio_rec.sh.service
#systemctl --user restart streamutil@audio_rec.sh.service
;;
on)
systemctl --user restart [email protected]
systemctl --user restart [email protected]
#systemctl --user restart streamutil@audio_rec.sh.service
#systemctl --user restart [email protected]
#systemctl --user restart [email protected]
#systemctl --user start [email protected]
;;
online)
systemctl --user restart [email protected]
systemctl --user restart [email protected]
;;
offline)
systemctl --user stop [email protected]
systemctl --user stop [email protected]
;;
neston)
systemctl --user restart [email protected]
;;
nestoff)
systemctl --user stop [email protected]
;;
esac
done < <(mosquitto_sub -h mqtt.lan $(<.mqttcreds) -t local/birdfeeder/status)