cryptonas/debian/cryptobox-server.init
lars 794998f950 broken interface fixed in 'partition' plugin for ie
rendering bug of volume_properties fixed for ie
fixed screen width in a mozilla/ie compatible way
added german translation: 'log', 'network', 'volume_automount' and 'volume_details'
fixed config management of 'plugin_manager' plugin
fixed filtering of log level messages for 'logs' plugin
updated documentation for ssl configurations
changed default installation destinations in setup.py
added nice background images to environment and help messages
replaced message 'div' with 'fieldset'
moved stylesheet data of plugins to html header (as required by spec)
removed obsolete css definitions
removed obsolete old perl/bash code
improved 'update_po_files': remove obsolete msgids
functionality of 'update_english.sh' moved to 'update_po_files'
omit 'weblang' link attribute if it does not change the default setting
changed default language from 'de' to 'en'
fixed template bug that prevented the translation of plugin links
fixed invalid html
implement filecheck overriding for unittests
2006-12-18 13:37:08 +00:00

110 lines
2.9 KiB
Bash

#!/bin/sh
#
# runlevel script of the cryptobox package
#
# Copyright (c) 02006, senselab
#
# see LICENSE file in this package for details
#
### BEGIN INIT INFO
# Provides: cryptobox-server
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start CryptoBox webserver
### END INIT INFO
# read the default setting file, if it exists
[ -r /etc/default/cryptobox-server ] && source /etc/default/cryptobox-server
# set default values (if not defined in /etc/default/cryptobox-server)
NO_START=${NO_START:-0}
RUNAS=${RUNAS:-cryptobox}
PORT=${PORT:-8080}
HOST=${HOST:-}
LOGFILE=/var/log/cryptobox-server/webserver.log
SERVER_OPTS=${SERVER_OPTS:-}
CONF_FILE=/etc/cryptobox-server/cryptobox.conf
# quit if NO_START is 1 (see /etc/default/cryptobox-server)
[ "$NO_START" = "1" ] && exit 0
DAEMON=/usr/sbin/CryptoBoxWebserver
# default install location is /usr/bin/ - debian installation requires /usr/sbin/
test -x "$DAEMON" || DAEMON=/usr/bin/CryptoBoxWebserver
PYTHON_EXEC=/usr/bin/python
PIDFILE=/var/run/cryptobox-server/webserver.pid
DESC="CryptoBox Daemon (webinterface)"
OPTIONS="-B --pidfile=$PIDFILE --config=$CONF_FILE --logfile=$LOGFILE --host=$HOST --port=$PORT $SERVER_OPTS"
# check if the package is installed
test -e "$DAEMON" || exit 0
# include some useful functions to unify our output format
. /lib/lsb/init-functions
case "$1" in
start )
# create the directory of the pid file if necessary
PIDDIR=$(dirname "$PIDFILE")
if [ -d "$PIDDIR" ]
then mkdir -p "$PIDDIR"
chown $RUNAS:root "$PIDDIR"
chmod 755 "$PIDDIR"
fi
log_daemon_msg "Starting $DESC"
if start-stop-daemon \
--chuid $RUNAS: --quiet --start \
--user $RUNAS --pidfile "$PIDFILE" \
--startas "$PYTHON_EXEC" -- "$DAEMON" $OPTIONS
then log_end_msg 0
else log_end_msg 1
fi
;;
stop )
log_daemon_msg "Stopping cryptobox webserver" "$DESC"
# if there is no pid file for some reason, then we try to find the process
if test ! -e "$PIDFILE"
then if start-stop-daemon --quiet --stop --user "$RUNAS" --exec "$PYTHON_EXEC"
then log_end_msg 0
else log_end_msg 1
fi
# there is a pid file - great!
elif start-stop-daemon --quiet --stop \
--pidfile "$PIDFILE" \
--user "$RUNAS"
then test -e "$PIDFILE" && rm "$PIDFILE"
log_end_msg 0
else log_end_msg 1
fi
;;
reload | force-reload | restart )
"$0" stop
sleep 1
"$0" start
;;
status )
echo -n "$DESC "
if start-stop-daemon --stop --signal 0 --quiet \
--pidfile "$PIDFILE" --user "$RUNAS"
then echo "running"
exit 0
else if [ -e "$PIDFILE" ]
then echo "failed"
exit 1
else echo "not running"
exit 0
fi
fi
;;
* )
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0