mirror of https://github.com/OpenIPC/firmware.git
50 lines
708 B
Bash
Executable File
50 lines
708 B
Bash
Executable File
#!/bin/sh
|
|
|
|
DAEMON="majestic"
|
|
PIDFILE="/var/run/$DAEMON.pid"
|
|
MAJESTIC_ARGS="-s"
|
|
|
|
debug() {
|
|
ulimit -c unlimited
|
|
echo "/tmp/core.%e.%h.%t" > /proc/sys/kernel/core_pattern
|
|
}
|
|
|
|
start() {
|
|
export SENSOR=$(fw_printenv -n sensor)
|
|
printf "Starting $DAEMON: "
|
|
start-stop-daemon -b -S -m -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" -- $MAJESTIC_ARGS
|
|
if [ $? = 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
printf "Stopping $DAEMON: "
|
|
start-stop-daemon -K -q -p "$PIDFILE"
|
|
if [ $? = 0 ]; then
|
|
rm -f "$PIDFILE"
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
start|stop|debug)
|
|
"$1"
|
|
;;
|
|
|
|
restart)
|
|
stop
|
|
sleep 3
|
|
start
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {start|stop|debug|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|