You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.3 KiB
98 lines
2.3 KiB
#! /bin/sh |
|
# |
|
# GeneWeb Start the GeneWeb HTTP server. |
|
# |
|
### BEGIN INIT INFO |
|
# Provides: geneweb |
|
# Required-Start: $network $local_fs $remote_fs |
|
# Should-Start: |
|
# Required-Stop: $remote_fs |
|
# Default-Start: 2 3 4 5 |
|
# Default-Stop: 0 1 6 |
|
# Should-Stop: |
|
# Short-Description: Geneweb genealogical data server |
|
### END INIT INFO |
|
|
|
# Do not change the values below |
|
GENEWEBSHARE=/usr/share/geneweb |
|
GENEWEBDOC=/usr/share/doc/geneweb |
|
GENEWEBDB=/var/lib/geneweb |
|
GENEWEBUSER=geneweb |
|
DAEMON=/usr/bin/gwd |
|
NAME=geneweb |
|
LOGFILE=/var/log/$NAME.log |
|
|
|
# Defaults |
|
# The port which the daemon listens to |
|
PORT=2317 |
|
# 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 config file (will override defaults above) |
|
[ -r /etc/default/geneweb ] && . /etc/default/geneweb |
|
|
|
# Export variables so that they may be used by the wrapper script |
|
export LNG 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) |
|
# Deal with log files generated by bogus Debian package |
|
# (bug #146748) |
|
if [ -f /var/log/.log ] |
|
then |
|
mv /var/log/.log $LOGFILE |
|
fi |
|
log_begin_msg "Starting GeneWeb server" "gwd" |
|
if ! start-stop-daemon -b --start --quiet --chuid $GENEWEBUSER --umask 007 --exec $DAEMON \ |
|
-- -hd$GENEWEBSHARE -dd$GENEWEBDOC -bd$GENEWEBDB -p$PORT \ |
|
-lang$LNG -log$LOGFILE $OPTIONS -daemon; then |
|
log_end_msg 1 |
|
exit 1 |
|
fi |
|
log_end_msg 0 |
|
;; |
|
|
|
stop) |
|
log_begin_msg "Stopping GeneWeb server" "gwd" |
|
start-stop-daemon --stop --quiet --exec $DAEMON -- \ |
|
-hd$GENEWEBSHARE -dd$GENEWEBDOC -bd$GENEWEBDB -p$PORT \ |
|
-lang$LANG -log$LOGFILE -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 |
|
|
|
|