2020-06-12 19:40:29 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
DAEMON="earlyoom"
|
|
|
|
PIDFILE="/var/run/$DAEMON.pid"
|
|
|
|
|
|
|
|
EARLYOOM_ARGS=""
|
|
|
|
|
|
|
|
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
|
|
|
|
|
|
|
start() {
|
2023-05-29 15:44:00 +02:00
|
|
|
printf 'Starting %s: ' "$DAEMON"
|
2023-05-29 15:43:56 +02:00
|
|
|
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/bin/$DAEMON" \
|
2020-06-12 19:40:29 +02:00
|
|
|
-- $EARLYOOM_ARGS
|
|
|
|
status=$?
|
|
|
|
if [ "$status" -eq 0 ]; then
|
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "FAIL"
|
|
|
|
fi
|
|
|
|
return "$status"
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
printf 'Stopping %s: ' "$DAEMON"
|
|
|
|
start-stop-daemon -K -q -p "$PIDFILE"
|
|
|
|
status=$?
|
|
|
|
if [ "$status" -eq 0 ]; then
|
|
|
|
rm -f "$PIDFILE"
|
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "FAIL"
|
|
|
|
fi
|
|
|
|
return "$status"
|
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start|stop|restart)
|
|
|
|
"$1";;
|
|
|
|
reload)
|
|
|
|
restart;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
|
|
exit 1
|
|
|
|
esac
|