2006-11-06 17:05:00 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
CBXSERVER=CryptoBoxWebserver.py
|
|
|
|
|
2006-11-10 10:05:54 +01:00
|
|
|
if test -e "./$CBXSERVER"
|
|
|
|
then CBXPATH=$(pwd)
|
|
|
|
else CBXPATH=/usr/lib/cryptobox
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2006-11-06 17:05:00 +01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Starting $DESC: "
|
2006-11-10 10:05:54 +01:00
|
|
|
start-stop-daemon --background --chdir "$CBXPATH" --chuid "$RUNAS" --start --quiet --user "$RUNAS" --make-pidfile --pidfile "$PIDFILE" --exec "$DAEMON" -- $DAEMON_OPTS
|
2006-11-06 17:05:00 +01:00
|
|
|
echo "$NAME."
|
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
|
|
|
echo -n "Stopping $DESC: "
|
2006-11-10 10:05:54 +01:00
|
|
|
# does the pid file exist?
|
|
|
|
test ! -e "$PIDFILE" && echo "pid file ($PIDFILE) not found!" && exit 1
|
|
|
|
# kill all process with the parent pid that we saved before
|
|
|
|
pkill -f -P "$(cat $PIDFILE)" -u "$RUNAS" && rm "$PIDFILE"
|
2006-11-06 17:05:00 +01:00
|
|
|
echo "$NAME."
|
|
|
|
;;
|
2006-11-10 10:05:54 +01:00
|
|
|
restart )
|
|
|
|
"$0" stop
|
|
|
|
"$0" start
|
|
|
|
;;
|
2006-11-06 17:05:00 +01:00
|
|
|
*)
|
2006-11-10 10:05:54 +01:00
|
|
|
echo "Usage: $(basename $0) {start|stop|restart}" >&2
|
2006-11-06 17:05:00 +01:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|