2006-10-04 20:57:49 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
2007-05-10 10:38:53 +00:00
|
|
|
START=50
|
2006-08-05 02:44:34 +00:00
|
|
|
|
|
|
|
DEFAULT="/etc/default/miau"
|
|
|
|
OPTIONS="-d /etc/miau/"
|
|
|
|
LOG_DIR="/var/log/miau"
|
|
|
|
ERR_LOG="$LOG_DIR/error.log"
|
|
|
|
OUT_LOG="$LOG_DIR/miau.log"
|
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
start() {
|
|
|
|
[ -f $DEFAULT ] && . $DEFAULT
|
|
|
|
[ "$ENABLE_MIAU" = "yes" ] || exit 0
|
|
|
|
[ -f /var/run/miau.pid ] && {
|
|
|
|
echo "[ERROR] miau is running"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
[ -d $LOG_DIR ] || mkdir -p $LOG_DIR
|
|
|
|
/usr/bin/miau -f $OPTIONS > $OUT_LOG 2> $ERR_LOG &
|
|
|
|
PID=$!
|
|
|
|
sleep 1
|
|
|
|
if [ -d /proc/$PID ]; then
|
|
|
|
echo $PID > /var/run/miau.pid
|
|
|
|
else
|
|
|
|
echo "[ERROR] Unable to run miau as a daemon"
|
|
|
|
fi
|
|
|
|
}
|
2006-08-05 02:44:34 +00:00
|
|
|
|
2006-10-04 20:57:49 +00:00
|
|
|
stop() {
|
|
|
|
[ -f /var/run/miau.pid ] && kill $(cat /var/run/miau.pid) >/dev/null 2>&1 && rm /var/run/miau.pid
|
|
|
|
}
|