[packages] miau: update to 0.6.6
[openwrt/svn-archive/archive.git] / net / miau / files / miau.init
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2006-2011 OpenWrt.org
3 START=50
4
5 OPTIONS="-d /etc/miau/"
6 LOG_DIR="/var/log/miau"
7 ERR_LOG="$LOG_DIR/error.log"
8 OUT_LOG="$LOG_DIR/miau.log"
9
10 start() {
11 [ -f /var/run/miau.pid ] && {
12 echo "[ERROR] miau is running"
13 exit 0
14 }
15 [ -d $LOG_DIR ] || mkdir -p $LOG_DIR
16 /usr/bin/miau -f $OPTIONS > $OUT_LOG 2> $ERR_LOG &
17 PID=$!
18 sleep 1
19 if [ -d /proc/$PID ]; then
20 echo $PID > /var/run/miau.pid
21 else
22 echo "[ERROR] Unable to run miau as a daemon"
23 fi
24 }
25
26 stop() {
27 [ -f /var/run/miau.pid ] && kill $(cat /var/run/miau.pid) >/dev/null 2>&1 && rm /var/run/miau.pid
28 }