51 lines
792 B
Bash
51 lines
792 B
Bash
#! /bin/sh
|
|
|
|
CMD=sargon
|
|
OPTIONS=
|
|
|
|
test -r /etc/default/sargon && . /etc/default/sargon
|
|
|
|
if [ "$SARGON_TRACE" = "yes" ]; then
|
|
OPTIONS="$OPTIONS${OPTIONS:+ }-trace"
|
|
fi
|
|
|
|
if [ "$SARGON_DEBUG" = "yes" ]; then
|
|
OPTIONS="$OPTIONS${OPTIONS:+ }-debug"
|
|
fi
|
|
|
|
sargon_start() {
|
|
if [ -n "$(/sbin/pidof $CMD)" ]; then
|
|
echo >&2 "$0: $CMD is already running"
|
|
else
|
|
/usr/bin/$CMD $OPTIONS | /usr/bin/logger -t $CMD -p daemon.info &
|
|
fi
|
|
}
|
|
|
|
sargon_stop() {
|
|
/usr/bin/pkill $CMD
|
|
}
|
|
|
|
sargon_status() {
|
|
pid=$(/sbin/pidof $CMD)
|
|
if [ -n "$pid" ]; then
|
|
echo "$CMD is running (pid $pid)"
|
|
else
|
|
echo "$CMD is not running"
|
|
fi
|
|
}
|
|
|
|
case $1 in
|
|
start)
|
|
sargon_start
|
|
;;
|
|
stop)
|
|
sargon_stop
|
|
;;
|
|
restart)
|
|
sargon_stop
|
|
sargon_start
|
|
;;
|
|
status)
|
|
sargon_status
|
|
esac
|