~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/gwsetup

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

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