wifibroadcast-ng: check for process on startup

pull/1696/head
viktorxda 2025-02-01 15:30:13 +01:00
parent 30f33430e8
commit a07a4082e8
2 changed files with 317 additions and 317 deletions

View File

@ -5,7 +5,8 @@ wfb_dev=wlan0
wfb_yaml() { wfb_yaml() {
if [ -e "$1" ]; then if [ -e "$1" ]; then
while IFS=: read -r key value; do while IFS=: read -r key value; do
value=$(eval echo $value) key=$(eval echo "$key")
value=$(eval echo "$value")
export "$key=$value" export "$key=$value"
done < "$1" done < "$1"
fi fi
@ -129,6 +130,7 @@ start() {
killall -1 majestic killall -1 majestic
fi fi
stop
start_broadcast start_broadcast
start_tunnel start_tunnel
start_telemetry start_telemetry
@ -136,7 +138,10 @@ start() {
stop() { stop() {
for process in wfb_rx wfb_tx wfb_tun msposd mavfwd; do for process in wfb_rx wfb_tx wfb_tun msposd mavfwd; do
killall -q "$process" if [ -n "$(pidof $process)" ]; then
echo "- Stopping $process"
killall -q "$process"
fi
done done
} }
@ -145,11 +150,6 @@ case "$1" in
$1 $1
;; ;;
restart|reload)
stop
start
;;
reset) reset)
cp -f /rom/etc/majestic.yaml /etc/majestic.yaml cp -f /rom/etc/majestic.yaml /etc/majestic.yaml
cp -f /rom/etc/wfb.yaml /etc/wfb.yaml cp -f /rom/etc/wfb.yaml /etc/wfb.yaml
@ -157,7 +157,7 @@ case "$1" in
;; ;;
*) *)
echo "Usage: $0 {start|stop|restart|reload|reset}" echo "Usage: $0 {start|stop|reset}"
exit 1 exit 1
;; ;;
esac esac

View File

@ -286,7 +286,7 @@
if (configData.wfb) { if (configData.wfb) {
syncForm(configData.wfb, 'wfb', "update"); syncForm(configData.wfb, 'wfb', "update");
uploadYAML(configData.wfb, '/etc/wfb.yaml'); uploadYAML(configData.wfb, '/etc/wfb.yaml');
executeDelay(this, 'wifibroadcast restart'); executeDelay(this, 'wifibroadcast start');
} }
}); });