#! /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 GWSETUPONLYFILE=/etc/geneweb/gwsetup_only.txt # 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 GWSETUPONLYFILE 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 $GWSETUPONLYFILE \ -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