1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
#! /bin/sh
#
# GeneWeb Start the Gwsetup mini HTTP server.
#
### BEGIN INIT INFO
# Provides: gwsetup
# Required-Start: $network $local_fs $remote_fs geneweb
# Should-Start:
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Stop:
# Short-Description: Geneweb setup web interface
### END INIT INFO
# Do not change the values below
GENEWEBSHARE=/usr/share/geneweb
GENEWEBDB=/var/lib/geneweb
GENEWEBUSER=geneweb
DAEMON=/usr/bin/gwsetup
WRAPPER=/usr/lib/geneweb/gwsetup.wrapper
NAME=gwsetup
LOGFILE=/var/log/$NAME.log
# Defaults
# The port which the daemon listens to
GWSETUP_PORT=2316
# The default language
LNG=en
# Run Mode : if anything else than "daemon", no daemon will be
# launched automatically
RUN_MODE="Always on"
# Additionnal options
OPTIONS=""
# Reads geneweb config file (for language)
[ -r /etc/default/geneweb ] && . /etc/default/geneweb
# Reads gwsetup config file (for other settings)
[ -r /etc/default/gwsetup ] && . /etc/default/gwsetup
# Export variables so that they may be used by the wrapper script
export LNG GWSETUP_PORT LOGFILE NAME DAEMON GENEWEBDB GENEWEBDOC GENEWEBSHARE OPTIONS
trap "" 1
test -f $DAEMON || exit 0
. /lib/lsb/init-functions
# We start (or stop) the daemon only when configured
# for running in daemon mode
if [ "$RUN_MODE" != "Always on" ]; then
exit 0
fi
start_stop()
{
case "$1" in
start)
log_begin_msg "Starting gwsetup server" "gwsetup"
if ! start-stop-daemon -b --start --quiet --chuid $GENEWEBUSER --exec $WRAPPER; then
log_end_msg 1
exit 1
fi
log_end_msg 0
;;
stop)
log_begin_msg "Stopping gwsetup server" "gwsetup"
start-stop-daemon --stop --quiet --exec $DAEMON -- \
-gd$GENEWEBSHARE -only /etc/geneweb \
-lang$LANG -daemon
log_end_msg 0
;;
restart | force-reload)
start_stop stop
sleep 2
start_stop start
;;
*)
log_success_msg "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}"
exit 1
;;
esac
}
start_stop "$@"
exit 0
|