View | Details | Raw Unified | Return to bug 13791
Collapse All | Expand All

(-)a/debian/koha-common.init (-36 / +32 lines)
Lines 40-45 fi Link Here
40
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
40
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
41
. /lib/lsb/init-functions
41
. /lib/lsb/init-functions
42
42
43
# include helper functions
44
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
45
    . "/usr/share/koha/bin/koha-functions.sh"
46
else
47
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
48
    exit 1
49
fi
50
43
#
51
#
44
# Function that starts the daemon/service
52
# Function that starts the daemon/service
45
#
53
#
Lines 49-54 do_start() Link Here
49
    koha-create-dirs $(koha-list)
57
    koha-create-dirs $(koha-list)
50
    koha-start-zebra $(koha-list --enabled)
58
    koha-start-zebra $(koha-list --enabled)
51
    koha-start-sip $(koha-list --enabled)
59
    koha-start-sip $(koha-list --enabled)
60
    koha-plack --start --quiet $(koha-list --enabled --plack)
52
61
53
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
62
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
54
        koha-indexer --start --quiet $(koha-list --enabled)
63
        koha-indexer --start --quiet $(koha-list --enabled)
Lines 63-68 do_stop() Link Here
63
    # We stop everything, including disabled ones.
72
    # We stop everything, including disabled ones.
64
    koha-stop-zebra $(koha-list) || true
73
    koha-stop-zebra $(koha-list) || true
65
    koha-stop-sip $(koha-list) || true
74
    koha-stop-sip $(koha-list) || true
75
    koha-plack --stop --quiet $(koha-list --enabled --plack)
66
76
67
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
77
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
68
        koha-indexer --stop --quiet $(koha-list --enabled)
78
        koha-indexer --stop --quiet $(koha-list --enabled)
Lines 76-81 do_reload() { Link Here
76
    koha-restart-zebra $(koha-list --enabled)
86
    koha-restart-zebra $(koha-list --enabled)
77
    koha-stop-sip $(koha-list) || true
87
    koha-stop-sip $(koha-list) || true
78
    koha-start-sip $(koha-list --enabled)
88
    koha-start-sip $(koha-list --enabled)
89
    koha-plack --restart --quiet $(koha-list --enabled --plack)
79
90
80
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
91
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
81
        koha-indexer --restart --quiet $(koha-list --enabled)
92
        koha-indexer --restart --quiet $(koha-list --enabled)
Lines 83-121 do_reload() { Link Here
83
}
94
}
84
95
85
#
96
#
86
# Function that checks zebrasrv is running for the specified instance
87
#
88
is_zebra_running()
89
{
90
    local instancename=$1
91
92
    if daemon --name="$instancename-koha-zebra" \
93
            --user="$instancename-koha.$instancename-koha" \
94
            --running ; then
95
        return 0
96
    else
97
        return 1
98
    fi
99
}
100
101
#
102
# Function that checks SIP server is running for the specified instance
103
#
104
is_sip_running()
105
{
106
    local instancename=$1
107
108
    if daemon --name="$instancename-koha-sip" \
109
            --pidfiles="/var/run/koha/$instancename" \
110
            --user="$instancename-koha.$instancename-koha" \
111
            --running ; then
112
        return 0
113
    else
114
        return 1
115
    fi
116
}
117
118
#
119
# Function that shows the status of the zebrasrv daemon for
97
# Function that shows the status of the zebrasrv daemon for
120
# enabled instances
98
# enabled instances
121
#
99
#
Lines 123-129 zebra_status() Link Here
123
{
101
{
124
    for instance in $(koha-list --enabled); do
102
    for instance in $(koha-list --enabled); do
125
103
126
        log_daemon_msg "Zebra server running for instace $instance"
104
        log_daemon_msg "Zebra server running for instance $instance"
127
105
128
        if is_zebra_running $instance ; then
106
        if is_zebra_running $instance ; then
129
            log_end_msg 0
107
            log_end_msg 0
Lines 141-147 sip_status() Link Here
141
{
119
{
142
    for instance in $(koha-list --enabled --sip); do
120
    for instance in $(koha-list --enabled --sip); do
143
121
144
        log_daemon_msg "SIP server running for instace $instance"
122
        log_daemon_msg "SIP server running for instance $instance"
145
123
146
        if is_sip_running $instance ; then
124
        if is_sip_running $instance ; then
147
            log_end_msg 0
125
            log_end_msg 0
Lines 151-156 sip_status() Link Here
151
    done
129
    done
152
}
130
}
153
131
132
#
133
# Function that shows the status of the Plack server daemon for
134
# enabled instances
135
#
136
plack_status()
137
{
138
    for instance in $(koha-list --enabled --plack); do
139
140
        log_daemon_msg "Plack server running for instance ${instance}"
141
142
        if is_plack_running $instance ; then
143
            log_end_msg 0
144
        else
145
            log_end_msg 1
146
        fi
147
    done
148
}
149
154
case "$1" in
150
case "$1" in
155
  start)
151
  start)
156
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
152
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
Lines 192-197 case "$1" in Link Here
192
  status)
188
  status)
193
        zebra_status
189
        zebra_status
194
        sip_status
190
        sip_status
191
        plack_status
195
        ;;
192
        ;;
196
  *)
193
  *)
197
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
194
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
198
- 

Return to bug 13791