cryptonas-branches/pythonrewrite/bin/cryptoboxd

40 lines
918 B
Plaintext
Raw Normal View History

2006-10-31 18:54:58 +01:00
#!/bin/sh
2006-10-31 19:40:11 +01:00
#TODO: CBXPATH=/usr/lib/cryptobox
CBXPATH=$(pwd)
CBXSERVER=CryptoBoxWebserver.py
PIDFILE=/var/run/cryptobox.pid
DAEMON=/usr/bin/python2.4
DAEMON_OPTS=${CBXPATH}/CryptoBoxWebserver.py
2006-10-31 18:54:58 +01:00
NAME=cryptoboxd
DESC="CryptoBox Daemon (webinterface)"
2006-10-31 19:40:11 +01:00
#TODO: RUNAS=cryptobox
RUNAS=$USERNAME
2006-10-31 18:54:58 +01:00
#test -x $DAEMON -a -f /etc/exports || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
2006-10-31 19:40:11 +01:00
start-stop-daemon --background --chdir "$CBXPATH" --chuid "$RUNAS" --start --quiet --oknodo --user "$RUNAS" --make-pidfile --pidfile "$PIDFILE" --exec "$DAEMON" \
2006-10-31 18:54:58 +01:00
-- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
2006-10-31 19:40:11 +01:00
#FIXME: this is the same as "killall python2.4"
# using a pid file instead prevents problems, but does not kill children???
start-stop-daemon --stop --oknodo --exec "$DAEMON"
2006-10-31 18:54:58 +01:00
echo "$NAME."
;;
*)
2006-10-31 19:40:11 +01:00
echo "Usage: $(basename $0) {start|stop}" >&2
2006-10-31 18:54:58 +01:00
exit 1
;;
esac
exit 0