mirror of
https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git
synced 2025-09-02 20:52:41 +02:00
* Change descriptions of MQTT topics to match Web UI (#1637) * Allow MQTT to start/stop the "timelapse" service (#1637) * Add manual switch for Night Mode to the sidebar (#1637) * Add friendly names to the current list of services (#1637) This adds a list of more user-friendly names to the services page. If a new service is added in the future this list should be updated, or the display name will default to the filename just as it did before.
37 lines
514 B
Bash
37 lines
514 B
Bash
#!/bin/sh
|
|
PIDFILE='/run/timelapse.pid'
|
|
|
|
status()
|
|
{
|
|
pid="$(cat "$PIDFILE" 2>/dev/null)"
|
|
if [ "$pid" ]; then
|
|
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
|
|
fi
|
|
}
|
|
|
|
start()
|
|
{
|
|
LOG=/dev/null
|
|
echo "Starting timelapse"
|
|
/system/sdcard/bin/busybox nohup /system/sdcard/scripts/timelapse.sh &> /dev/null &
|
|
PID=$!
|
|
echo $PID > $PIDFILE
|
|
echo $PID
|
|
}
|
|
|
|
stop()
|
|
{
|
|
PID=$(cat $PIDFILE)
|
|
kill -9 $PID
|
|
rm $PIDFILE
|
|
}
|
|
|
|
if [ $# -eq 0 ]; then
|
|
start
|
|
else
|
|
case $1 in start|stop|status)
|
|
$1
|
|
;;
|
|
esac
|
|
fi
|