1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-02 20:52:41 +02:00
Files
Combie81 5548ab554f Moving config entries/cleanup
Moved some configutation options to the config files

Minor text changes

Converted a lot of spaces to tabs
2020-07-16 10:20:39 +02:00

43 lines
780 B
Bash

#!/bin/sh
PIDFILE="/run/mqtt-status.pid"
if [ ! -f /system/sdcard/config/mqtt.conf ]; then
echo "You have to configure mqtt first. Please see /system/sdcard/config/mqtt.conf.dist for further instructions"
fi
status()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
fi
}
start()
{
if [ -f $PIDFILE ]; then
echo "MQTT-Status already running";
else
echo "Starting MQTT-Status"
/system/sdcard/bin/busybox nohup /system/sdcard/scripts/mqtt-status-interval.sh &>/dev/null &
echo "$!" > "$PIDFILE"
fi
}
stop()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill "$pid" && rm "$PIDFILE"
fi
}
if [ $# -eq 0 ]; then
start
else
case $1 in start|stop|status)
$1
;;
esac
fi