fix motion download url
[openwrt.git] / openwrt / package / miau / files / S50miau
1 #!/bin/sh
2
3 DEFAULT="/etc/default/miau"
4 OPTIONS="-d /etc/miau/"
5 LOG_DIR="/var/log/miau"
6 ERR_LOG="$LOG_DIR/error.log"
7 OUT_LOG="$LOG_DIR/miau.log"
8
9 [ -f $DEFAULT ] && . $DEFAULT
10 [ "$ENABLE_MIAU" = "yes" ] || exit 0
11
12 case $1 in
13 start)
14 [ -f /var/run/miau.pid ] && echo "[ERROR] miau is running"
15 [ -f /var/run/miau.pid ] && exit 0
16 [ -d /var/run ] || mkdir -p /var/run
17 [ -d $LOG_DIR ] || mkdir -p $LOG_DIR
18 /usr/bin/miau -f $OPTIONS > $OUT_LOG 2> $ERR_LOG &
19 PID=$!
20 sleep 1
21 [ -d /proc/$PID ] && echo $PID > /var/run/miau.pid
22 [ -d /proc/$PID ] || echo "[ERROR] Unable to run miau as a daemon"
23 ;;
24 stop)
25 [ -f /var/run/miau.pid ] && kill $(cat /var/run/miau.pid) >/dev/null 2>&1 && rm /var/run/miau.pid
26 ;;
27 *)
28 echo "usage: $0 (start|stop)"
29 exit 1
30 esac
31
32 exit $?
This page took 0.044804 seconds and 5 git commands to generate.