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

(-)a/debian/docs/koha-common.xml (-16 / +2 lines)
Lines 119-134 Link Here
119
    <variablelist>
119
    <variablelist>
120
120
121
      <varlistentry>
121
      <varlistentry>
122
        <term><option>koha-start-zebra</option></term>
122
        <term><option>koha-zebra</option></term>
123
        <listitem>
123
        <listitem>
124
          <para>Start Zebra for named Koha instances.</para>
124
          <para>Manage the Zebra daemon for named Koha instances.</para>
125
        </listitem>
126
      </varlistentry>
127
128
      <varlistentry>
129
        <term><option>koha-restart-zebra</option></term>
130
        <listitem>
131
          <para>Restart Zebra for named Koha instances.</para>
132
        </listitem>
125
        </listitem>
133
      </varlistentry>
126
      </varlistentry>
134
127
Lines 139-151 Link Here
139
        </listitem>
132
        </listitem>
140
      </varlistentry>
133
      </varlistentry>
141
134
142
      <varlistentry>
143
        <term><option>koha-stop-zebra</option></term>
144
        <listitem>
145
          <para>Stop Zebra for named Koha instances.</para>
146
        </listitem>
147
      </varlistentry>
148
149
      <varlistentry>
135
      <varlistentry>
150
        <term><option>koha-indexer</option></term>
136
        <term><option>koha-indexer</option></term>
151
        <listitem>
137
        <listitem>
(-)a/debian/docs/koha-rebuild-zebra.xml (-3 / +1 lines)
Lines 86-94 Link Here
86
  
86
  
87
  <refsect1><title>See also</title>
87
  <refsect1><title>See also</title>
88
  <simplelist type="inline">
88
  <simplelist type="inline">
89
    <member><command>koha-restart-zebra(8)</command></member>
89
    <member><command>koha-zebra(8)</command></member>
90
    <member><command>koha-start-zebra(8)</command></member>
91
    <member><command>koha-stop-zebra(8)</command></member>
92
  </simplelist>
90
  </simplelist>
93
  </refsect1>
91
  </refsect1>
94
  
92
  
(-)a/debian/docs/koha-restart-zebra.xml (-44 lines)
Lines 1-44 Link Here
1
<article xmlns='http://docbook.org/ns/docbook'>
2
<title>koha-restart-zebra</title>
3
<info>
4
<productname>Koha</productname> is the first free software library automation package.
5
<author>
6
  <orgname>The Koha Community</orgname>
7
  <uri>http://koha-community.org/</uri>
8
</author>
9
</info>
10
11
<refentry xml:id="koha-restart-zebra">
12
13
  <refmeta>
14
    <refentrytitle>koha-restart-zebra</refentrytitle>
15
    <manvolnum>8</manvolnum>
16
  </refmeta>
17
18
  <refnamediv>
19
    <refname>koha-restart-zebra</refname>
20
    <refpurpose>Restart Zebra for named Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
23
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
26
      <command>koha-restart-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
29
30
  <refsect1><title>Description</title>
31
  <para>Restart Zebra for named Koha instances.</para>
32
  </refsect1>
33
  
34
  <refsect1><title>See also</title>
35
  <simplelist type="inline">
36
    <member><command>koha-rebuild-zebra(8)</command></member>
37
    <member><command>koha-start-zebra(8)</command></member>
38
    <member><command>koha-stop-zebra(8)</command></member>
39
  </simplelist>
40
  </refsect1>
41
  
42
</refentry>
43
44
</article>
(-)a/debian/docs/koha-start-zebra.xml (-44 lines)
Lines 1-44 Link Here
1
<article xmlns='http://docbook.org/ns/docbook'>
2
<title>koha-start-zebra</title>
3
<info>
4
<productname>Koha</productname> is the first free software library automation package.
5
<author>
6
  <orgname>The Koha Community</orgname>
7
  <uri>http://koha-community.org/</uri>
8
</author>
9
</info>
10
11
<refentry xml:id="koha-start-zebra">
12
13
  <refmeta>
14
    <refentrytitle>koha-start-zebra</refentrytitle>
15
    <manvolnum>8</manvolnum>
16
  </refmeta>
17
18
  <refnamediv>
19
    <refname>koha-start-zebra</refname>
20
    <refpurpose>Start Zebra for named Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
23
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
26
      <command>koha-start-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
29
30
  <refsect1><title>Description</title>
31
  <para>Start Zebra for named Koha instances.</para>
32
  </refsect1>
33
  
34
  <refsect1><title>See also</title>
35
  <simplelist type="inline">
36
    <member><command>koha-rebuild-zebra(8)</command></member>
37
    <member><command>koha-restart-zebra(8)</command></member>
38
    <member><command>koha-stop-zebra(8)</command></member>
39
  </simplelist>
40
  </refsect1>
41
  
42
</refentry>
43
44
</article>
(-)a/debian/docs/koha-stop-zebra.xml (-44 lines)
Lines 1-44 Link Here
1
<article xmlns='http://docbook.org/ns/docbook'>
2
<title>koha-stop-zebra</title>
3
<info>
4
<productname>Koha</productname> is the first free software library automation package.
5
<author>
6
  <orgname>The Koha Community</orgname>
7
  <uri>http://koha-community.org/</uri>
8
</author>
9
</info>
10
11
<refentry xml:id="koha-stop-zebra">
12
13
  <refmeta>
14
    <refentrytitle>koha-stop-zebra</refentrytitle>
15
    <manvolnum>8</manvolnum>
16
  </refmeta>
17
18
  <refnamediv>
19
    <refname>koha-stop-zebra</refname>
20
    <refpurpose>Stop Zebra for named Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
23
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
26
      <command>koha-stop-zebra</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
29
30
  <refsect1><title>Description</title>
31
  <para>Stop Zebra for named Koha instances.</para>
32
  </refsect1>
33
  
34
  <refsect1><title>See also</title>
35
  <simplelist type="inline">
36
    <member><command>koha-rebuild-zebra(8)</command></member>
37
    <member><command>koha-restart-zebra(8)</command></member>
38
    <member><command>koha-start-zebra(8)</command></member>
39
  </simplelist>
40
  </refsect1>
41
  
42
</refentry>
43
44
</article>
(-)a/debian/koha-common.bash-completion (-5 lines)
Lines 130-140 complete -F _koha_disabled_instances koha-enable Link Here
130
# koha-disable autocompletes with enabled instances
130
# koha-disable autocompletes with enabled instances
131
complete -F _koha_enabled_instances koha-disable
131
complete -F _koha_enabled_instances koha-disable
132
132
133
# koha-*-zebra autocomplete with enabled instances
134
complete -F _koha_enabled_instances koha-start-zebra
135
complete -F _koha_enabled_instances koha-restart-zebra
136
complete -F _koha_enabled_instances koha-stop-zebra
137
138
# koha-mysql autocompletes with a single instance name
133
# koha-mysql autocompletes with a single instance name
139
complete -F _koha_single_instance koha-mysql
134
complete -F _koha_single_instance koha-mysql
140
135
(-)a/debian/koha-common.install (-3 lines)
Lines 26-38 debian/scripts/koha-plack usr/sbin Link Here
26
debian/scripts/koha-rebuild-zebra           usr/sbin
26
debian/scripts/koha-rebuild-zebra           usr/sbin
27
debian/scripts/koha-remove                  usr/sbin
27
debian/scripts/koha-remove                  usr/sbin
28
debian/scripts/koha-reset-passwd            usr/sbin
28
debian/scripts/koha-reset-passwd            usr/sbin
29
debian/scripts/koha-restart-zebra           usr/sbin
30
debian/scripts/koha-restore                 usr/sbin
29
debian/scripts/koha-restore                 usr/sbin
31
debian/scripts/koha-run-backups             usr/sbin
30
debian/scripts/koha-run-backups             usr/sbin
32
debian/scripts/koha-shell                   usr/sbin
31
debian/scripts/koha-shell                   usr/sbin
33
debian/scripts/koha-sitemap                 usr/sbin
32
debian/scripts/koha-sitemap                 usr/sbin
34
debian/scripts/koha-start-zebra             usr/sbin
35
debian/scripts/koha-stop-zebra              usr/sbin
36
debian/scripts/koha-translate               usr/sbin
33
debian/scripts/koha-translate               usr/sbin
37
debian/scripts/koha-upgrade-schema          usr/sbin
34
debian/scripts/koha-upgrade-schema          usr/sbin
38
debian/scripts/koha-upgrade-to-3.4          usr/sbin
35
debian/scripts/koha-upgrade-to-3.4          usr/sbin
(-)a/debian/koha-common.links (+3 lines)
Line 0 Link Here
1
usr/sbin/koha-zebra  usr/sbin/koha-start-zebra
2
usr/sbin/koha-zebra  usr/sbin/koha-stop-zebra
3
usr/sbin/koha-zebra  usr/sbin/koha-restart-zebra
(-)a/debian/scripts/koha-restart-zebra (-116 lines)
Lines 1-116 Link Here
1
#!/bin/sh
2
#
3
# koha-restart-zebra - Restart Zebra for named Koha instances
4
# Copyright 2010  Catalyst IT, Ltd
5
# 
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
# 
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
# 
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
set -e
20
21
# include helper functions
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
27
fi
28
29
restart_zebra_instance()
30
{
31
    local instancename=$1
32
33
    if is_zebra_running $instancename; then
34
        echo "Restarting Zebra server for $instancename"
35
        daemon \
36
            --name="$instancename-koha-zebra" \
37
            --pidfiles="/var/run/koha/$instancename/" \
38
            --errlog="/var/log/koha/$instancename/zebra-error.log" \
39
            --stdout="/var/log/koha/$instancename/zebra.log" \
40
            --output="/var/log/koha/$instancename/zebra-output.log" \
41
            --verbose=1 \
42
            --respawn \
43
            --delay=30 \
44
            --user="$instancename-koha.$instancename-koha" \
45
            --restart \
46
            -- \
47
            zebrasrv \
48
            -v none,fatal,warn \
49
            -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
50
        return 0
51
    else
52
        return 1
53
    fi
54
}
55
56
start_zebra_instance()
57
{
58
    local instancename=$1
59
60
    if is_enabled $instancename; then
61
        echo "Starting Zebra server for $instancename"
62
        daemon \
63
            --name="$instancename-koha-zebra" \
64
            --pidfiles="/var/run/koha/$instancename/" \
65
            --errlog="/var/log/koha/$instancename/zebra-error.log" \
66
            --stdout="/var/log/koha/$instancename/zebra.log" \
67
            --output="/var/log/koha/$instancename/zebra-output.log" \
68
            --verbose=1 \
69
            --respawn \
70
            --delay=30 \
71
            --user="$instancename-koha.$instancename-koha" \
72
            -- \
73
            zebrasrv \
74
            -v none,fatal,warn \
75
            -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
76
        return 0
77
    else
78
        return 1
79
    fi
80
}
81
82
usage()
83
{
84
    local scriptname=$0
85
    cat <<EOF
86
Restart Zebra for Koha instances.
87
88
Usage: $scriptname instancename1 instancename2...
89
90
EOF
91
}
92
93
# Parse command line.
94
#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
95
96
# Loop through the instance names
97
for name in "$@"
98
do
99
    if is_instance $name ; then
100
        if ! is_zebra_running $name; then
101
            warn "Zebra does not appear to have been running for instance $name."
102
103
            if ! start_zebra_instance $name ; then
104
                warn "Something went wrong starting Zebra for $name."
105
            fi
106
        else
107
            if ! restart_zebra_instance $name; then
108
              warn "Something went wrong restarting Zebra for $name."
109
            fi
110
        fi
111
    else
112
        warn "Unknown instance $name."
113
    fi
114
done
115
116
exit 0
(-)a/debian/scripts/koha-start-zebra (-89 lines)
Lines 1-89 Link Here
1
#!/bin/sh
2
#
3
# koha-start-zebra - Start Zebra for named Koha instances
4
# Copyright 2010  Catalyst IT, Ltd
5
# 
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
# 
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
# 
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
set -e
20
21
# include helper functions
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
27
fi
28
29
start_zebra_instance()
30
{
31
    local instancename=$1
32
33
    # get zebra log levels from koha-conf.xml
34
    local loglevels=$(get_loglevels $instancename)
35
36
    echo "Starting Zebra server for $instancename"
37
    touch "/var/log/koha/$instancename/zebra-error.log" \
38
        "/var/log/koha/$instancename/zebra-output.log"
39
    chown "$instancename-koha:$instancename-koha" \
40
        "/var/log/koha/$instancename/zebra-error.log" \
41
        "/var/log/koha/$instancename/zebra-output.log"
42
    daemon \
43
        --name="$instancename-koha-zebra" \
44
        --pidfiles="/var/run/koha/$instancename/" \
45
        --errlog="/var/log/koha/$instancename/zebra-error.log" \
46
        --output="/var/log/koha/$instancename/zebra-output.log" \
47
        --verbose=1 \
48
        --respawn \
49
        --delay=30 \
50
        --user="$instancename-koha.$instancename-koha" \
51
        -- \
52
        zebrasrv \
53
        -v $loglevels \
54
        -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
55
        return 0 || \
56
        return 1
57
}
58
59
usage()
60
{
61
    local scriptname=$0
62
    cat <<EOF
63
Starts Zebra for Koha instances.
64
65
Usage: $scriptname instancename1 instancename2...
66
67
EOF
68
}
69
70
# Parse command line.
71
#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
72
73
# Loop through the instance names
74
for name in "$@"
75
do
76
    if is_instance $name ; then
77
        if ! is_zebra_running $name; then
78
            if ! start_zebra_instance $name; then
79
                warn "Something went wrong starting Zebra for $name."
80
            fi
81
        else
82
            warn "Zebra already running for instance $name."
83
        fi
84
    else
85
        warn "Unknown instance $name."
86
    fi
87
done
88
89
exit 0
(-)a/debian/scripts/koha-stop-zebra (-75 lines)
Lines 1-74 Link Here
1
#!/bin/sh
2
#
3
# koha-stop-zebra - Stop Zebra for named Koha instances
4
# Copyright 2010  Catalyst IT, Ltd
5
# 
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
10
# 
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
# 
16
# You should have received a copy of the GNU General Public License
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
set -e
20
21
# include helper functions
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
27
fi
28
29
stop_zebra_instance()
30
{
31
    local instancename=$1
32
33
    local PIDFILE="/var/run/koha/${instancename}/${instancename}-koha-zebra.pid"
34
    echo "Stopping Zebra server for $instancename"
35
36
    if start-stop-daemon --pidfile ${PIDFILE} --stop --quiet --retry=TERM/30/KILL/5; then
37
        return 0;
38
    else
39
        return 1;
40
    fi
41
42
}
43
44
usage()
45
{
46
    local scriptname=$0
47
    cat <<EOF
48
Stops Zebra for Koha instances.
49
50
Usage: $scriptname instancename1 instancename2...
51
52
EOF
53
}
54
55
# Parse command line.
56
#[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
57
58
# Loop through the instance names
59
for name in "$@"
60
do
61
    if is_instance $name ; then
62
        if is_zebra_running $name; then
63
            if ! stop_zebra_instance $name; then
64
                warn "Something went wrong stopping Zebra for $name."
65
            fi
66
        else
67
            warn "Zebra already stopped for instance $name."
68
        fi
69
    else
70
        warn "Unknown instance $name."
71
    fi
72
done
73
74
exit 0
75
- 

Return to bug 17468