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

(-)a/debian/docs/koha-common.xml (+21 lines)
Lines 145-150 Link Here
145
          <para>Stop Zebra for named Koha instances.</para>
145
          <para>Stop Zebra for named Koha instances.</para>
146
        </listitem>
146
        </listitem>
147
      </varlistentry>
147
      </varlistentry>
148
149
      <varlistentry>
150
        <term><option>koha-start-indexer</option></term>
151
        <listitem>
152
          <para>Start the indexer daemon for named Koha instances.</para>
153
        </listitem>
154
      </varlistentry>
155
156
      <varlistentry>
157
        <term><option>koha-restart-indexer</option></term>
158
        <listitem>
159
          <para>Restart the indexer daemon for named Koha instances.</para>
160
        </listitem>
161
      </varlistentry>
162
163
      <varlistentry>
164
        <term><option>koha-stop-indexer</option></term>
165
        <listitem>
166
          <para>Stop the indexer daemon for named Koha instances.</para>
167
        </listitem>
168
      </varlistentry>
148
    </variablelist>
169
    </variablelist>
149
    </refsect2>
170
    </refsect2>
150
171
(-)a/debian/docs/koha-restart-indexer.xml (+43 lines)
Line 0 Link Here
1
<article xmlns='http://docbook.org/ns/docbook'>
2
<title>koha-restart-indexer</title>
3
<info>
4
<productname>Koha</productname> is the first free software library automation package.
5
<author>
6
  <orgname>The Koha Communnity</orgname>
7
  <uri>http://koha-community.org/</uri>
8
</author>
9
</info>
10
11
<refentry xml:id="koha-restart-indexer">
12
13
  <refmeta>
14
    <refentrytitle>koha-restart-indexer</refentrytitle>
15
    <manvolnum>8</manvolnum>
16
  </refmeta>
17
18
  <refnamediv>
19
    <refname>koha-restart-indexer</refname>
20
    <refpurpose>Restart the indexer daemon for named Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
23
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
26
      <command>koha-restart-indexer</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
29
30
  <refsect1><title>Description</title>
31
  <para>Restart the indexer daemon for named Koha instances.</para>
32
  </refsect1>
33
34
  <refsect1><title>See also</title>
35
  <simplelist type="inline">
36
    <member><command>koha-start-indexer(8)</command></member>
37
    <member><command>koha-stop-indexer(8)</command></member>
38
  </simplelist>
39
  </refsect1>
40
41
</refentry>
42
43
</article>
(-)a/debian/docs/koha-start-indexer.xml (+43 lines)
Line 0 Link Here
1
<article xmlns='http://docbook.org/ns/docbook'>
2
<title>koha-start-indexer</title>
3
<info>
4
<productname>Koha</productname> is the first free software library automation package.
5
<author>
6
  <orgname>The Koha Communnity</orgname>
7
  <uri>http://koha-community.org/</uri>
8
</author>
9
</info>
10
11
<refentry xml:id="koha-start-indexer">
12
13
  <refmeta>
14
    <refentrytitle>koha-start-indexer</refentrytitle>
15
    <manvolnum>8</manvolnum>
16
  </refmeta>
17
18
  <refnamediv>
19
    <refname>koha-start-indexer</refname>
20
    <refpurpose>Start the indexer daemon for named Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
23
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
26
      <command>koha-start-indexer</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
29
30
  <refsect1><title>Description</title>
31
  <para>Start the indexer daemon for named Koha instances.</para>
32
  </refsect1>
33
34
  <refsect1><title>See also</title>
35
  <simplelist type="inline">
36
    <member><command>koha-restart-indexer(8)</command></member>
37
    <member><command>koha-stop-indexer(8)</command></member>
38
  </simplelist>
39
  </refsect1>
40
41
</refentry>
42
43
</article>
(-)a/debian/docs/koha-stop-indexer.xml (+43 lines)
Line 0 Link Here
1
<article xmlns='http://docbook.org/ns/docbook'>
2
<title>koha-stop-indexer</title>
3
<info>
4
<productname>Koha</productname> is the first free software library automation package.
5
<author>
6
  <orgname>The Koha Communnity</orgname>
7
  <uri>http://koha-community.org/</uri>
8
</author>
9
</info>
10
11
<refentry xml:id="koha-stop-indexer">
12
13
  <refmeta>
14
    <refentrytitle>koha-stop-indexer</refentrytitle>
15
    <manvolnum>8</manvolnum>
16
  </refmeta>
17
18
  <refnamediv>
19
    <refname>koha-stop-indexer</refname>
20
    <refpurpose>Stop indexer daemon for named Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
23
24
  <refsynopsisdiv>
25
    <cmdsynopsis>
26
      <command>koha-stop-indexer</command> <arg choice="req" rep="repeat"><replaceable>instancename</replaceable></arg>
27
    </cmdsynopsis>
28
  </refsynopsisdiv>
29
30
  <refsect1><title>Description</title>
31
  <para>Stop indexer daemon for named Koha instances.</para>
32
  </refsect1>
33
34
  <refsect1><title>See also</title>
35
  <simplelist type="inline">
36
    <member><command>koha-restart-indexer(8)</command></member>
37
    <member><command>koha-start-indexer(8)</command></member>
38
  </simplelist>
39
  </refsect1>
40
41
</refentry>
42
43
</article>
(-)a/debian/koha-common.cron.d (+1 lines)
Lines 6-10 Link Here
6
SHELL=/bin/sh
6
SHELL=/bin/sh
7
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
8
8
9
# Comment the following line if you want to use the experimental koha-index-daemon integration
9
*/5 * * * * root test -x /usr/sbin/koha-rebuild-zebra && koha-rebuild-zebra $(koha-list --enabled)
10
*/5 * * * * root test -x /usr/sbin/koha-rebuild-zebra && koha-rebuild-zebra $(koha-list --enabled)
10
*/15 * * * * root koha-foreach --enabled --email /usr/share/koha/bin/cronjobs/process_message_queue.pl
11
*/15 * * * * root koha-foreach --enabled --email /usr/share/koha/bin/cronjobs/process_message_queue.pl
(-)a/debian/koha-common.default (+16 lines)
Line 0 Link Here
1
## General koha-common default options file
2
3
# If you want to use the koha-index-daemon script that is part of the
4
# Koha::Contrib::Tamil package instead of the cronjob, set USE_INDEXER_DAEMON
5
# to "yes". More information can be found here:
6
#     http://wiki.koha-community.org/wiki/PackagesIndexDaemon 
7
# Note: You should comment the relevant line in /etc/cron.d/koha-common
8
#
9
# The default value is "no"
10
#USE_INDEXER_DAEMON="no"
11
12
# If you are using the koha-index-daemon you can set the frecquency (in sec)
13
# of the indexes update.
14
#
15
# The default value is 30
16
#INDEXER_TIMEOUT=30
(-)a/debian/koha-common.init (-18 / +14 lines)
Lines 18-34 Link Here
18
# PATH should only include /usr/* if it runs after the mountnfs.sh script
18
# PATH should only include /usr/* if it runs after the mountnfs.sh script
19
PATH=/sbin:/usr/sbin:/bin:/usr/bin
19
PATH=/sbin:/usr/sbin:/bin:/usr/bin
20
DESC="Koha ILS"
20
DESC="Koha ILS"
21
NAME=daemonexecutablename
21
NAME="koha-common"
22
DAEMON=/usr/sbin/$NAME
23
DAEMON_ARGS="--options args"
24
PIDFILE=/var/run/$NAME.pid
25
SCRIPTNAME=/etc/init.d/$NAME
22
SCRIPTNAME=/etc/init.d/$NAME
26
23
27
# Exit if the package is not installed
24
# Exit if the package is not installed
28
[ -x /usr/sbin/koha-start-zebra ] || exit 0
25
[ -x /usr/sbin/koha-start-zebra ] || exit 0
29
26
30
# Read configuration variable file if it is present
27
# Read configuration variable file if it is present
31
# [ -r /etc/default/$NAME ] && . /etc/default/$NAME
28
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
32
29
33
# Load the VERBOSE setting and other rcS variables
30
# Load the VERBOSE setting and other rcS variables
34
. /lib/init/vars.sh
31
. /lib/init/vars.sh
Lines 46-51 do_start() Link Here
46
    koha-create-dirs $(koha-list)
43
    koha-create-dirs $(koha-list)
47
    koha-start-zebra $(koha-list --enabled)
44
    koha-start-zebra $(koha-list --enabled)
48
    koha-start-sip $(koha-list --enabled)
45
    koha-start-sip $(koha-list --enabled)
46
47
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
48
        koha-start-indexer $(koha-list --enabled)
49
    fi
49
}
50
}
50
51
51
#
52
#
Lines 56-61 do_stop() Link Here
56
    # We stop everything, including disabled ones.
57
    # We stop everything, including disabled ones.
57
    koha-stop-zebra $(koha-list) || true
58
    koha-stop-zebra $(koha-list) || true
58
    koha-stop-sip $(koha-list) || true
59
    koha-stop-sip $(koha-list) || true
60
61
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
62
        koha-stop-indexer $(koha-list --enabled)
63
    fi
59
}
64
}
60
65
61
#
66
#
Lines 65-70 do_reload() { Link Here
65
    koha-restart-zebra $(koha-list --enabled)
70
    koha-restart-zebra $(koha-list --enabled)
66
    koha-stop-sip $(koha-list) || true
71
    koha-stop-sip $(koha-list) || true
67
    koha-start-sip $(koha-list --enabled)
72
    koha-start-sip $(koha-list --enabled)
73
74
    if [ "$USE_INDEXER_DAEMON" = "yes" ]; then
75
        koha-restart-indexer $(koha-list --enabled)
76
    fi
68
}
77
}
69
78
70
case "$1" in
79
case "$1" in
Lines 84-101 case "$1" in Link Here
84
		*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
93
		*) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
85
	esac
94
	esac
86
	;;
95
	;;
87
#  status)
88
#       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
89
#       ;;
90
  #reload|force-reload)
91
	#
92
	# If do_reload() is not implemented then leave this commented out
93
	# and leave 'force-reload' as an alias for 'restart'.
94
	#
95
	#log_daemon_msg "Reloading $DESC" "$NAME"
96
	#do_reload
97
	#log_end_msg $?
98
	#;;
99
  restart|force-reload)
96
  restart|force-reload)
100
	#
97
	#
101
	# If the "reload" option is implemented then remove the
98
	# If the "reload" option is implemented then remove the
Lines 119-125 case "$1" in Link Here
119
	;;
116
	;;
120
  *)
117
  *)
121
	echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
118
	echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
122
	#echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
123
	exit 3
119
	exit 3
124
	;;
120
	;;
125
esac
121
esac
(-)a/debian/koha-common.install (+3 lines)
Lines 22-32 debian/scripts/koha-mysql usr/sbin Link Here
22
debian/scripts/koha-rebuild-zebra           usr/sbin
22
debian/scripts/koha-rebuild-zebra           usr/sbin
23
debian/scripts/koha-remove                  usr/sbin
23
debian/scripts/koha-remove                  usr/sbin
24
debian/scripts/koha-reset-passwd            usr/sbin
24
debian/scripts/koha-reset-passwd            usr/sbin
25
debian/scripts/koha-restart-indexer         usr/sbin
25
debian/scripts/koha-restart-zebra           usr/sbin
26
debian/scripts/koha-restart-zebra           usr/sbin
26
debian/scripts/koha-restore                 usr/sbin
27
debian/scripts/koha-restore                 usr/sbin
27
debian/scripts/koha-run-backups             usr/sbin
28
debian/scripts/koha-run-backups             usr/sbin
28
debian/scripts/koha-shell                   usr/sbin
29
debian/scripts/koha-shell                   usr/sbin
30
debian/scripts/koha-start-indexer           usr/sbin
29
debian/scripts/koha-start-zebra             usr/sbin
31
debian/scripts/koha-start-zebra             usr/sbin
32
debian/scripts/koha-stop-indexer            usr/sbin
30
debian/scripts/koha-stop-zebra              usr/sbin
33
debian/scripts/koha-stop-zebra              usr/sbin
31
debian/scripts/koha-translate               usr/sbin
34
debian/scripts/koha-translate               usr/sbin
32
debian/scripts/koha-upgrade-schema          usr/sbin
35
debian/scripts/koha-upgrade-schema          usr/sbin
(-)a/debian/scripts/koha-create (+3 lines)
Lines 340-345 then Link Here
340
340
341
    # Start Zebra.
341
    # Start Zebra.
342
    koha-start-zebra "$name"
342
    koha-start-zebra "$name"
343
344
    # Start Indexer daemon
345
    koha-start-indexer "$name"
343
fi
346
fi
344
347
345
348
(-)a/debian/scripts/koha-restart-indexer (+90 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# koha-restart-indexer - Restart Indexer Daemon for Koha instances
4
# Copyright 2012 Tomás Cohen Arazi @ Universidad Nacional de Córdoba
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
. /lib/lsb/init-functions
22
23
# Read configuration variable file if it is present
24
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
25
26
if [[ $INDEXER_TIMEOUT != *[!0-9]* ]]; then
27
    INDEXER_TIMEOUT=30
28
fi
29
30
warn()
31
{
32
    echo "$@" 1>&2
33
}
34
35
is_instance()
36
{
37
    local instancename=$1
38
39
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
40
                         -type d -printf '%f\n'\
41
          | grep -q -x $instancename ; then
42
        return 0
43
    else
44
        return 1
45
    fi
46
}
47
48
INDEXDAEMON="koha-index-daemon"
49
export PERL5LIB="/usr/share/koha/lib"
50
51
if [ ! -e /usr/share/perl5/Koha/Contrib/Tamil/IndexerDaemon.pm ] ; then
52
    MSG=`cat <<EOF
53
Koha::Contrib::Tamil::IndexerDaemon was not found. See
54
http://wiki.koha-community.org/wiki/PackagesIndexDaemon
55
for instructions on setting up the indexer daemon.
56
EOF`
57
58
    warn $MSG
59
    exit;
60
fi
61
62
for name in "$@"
63
do
64
    if is_instance $name; then
65
        export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml"
66
67
        INDEXDAEMON_OPTS="--timeout $INDEXER_TIMEOUT \
68
                        --conf $KOHA_CONF \
69
                        --directory /var/tmp/koha-indexer-daemon-$name"
70
71
        DAEMONOPTS="--name=$name-koha-indexer \
72
            --errlog=/var/log/koha/$name/koha-indexer-error.log \
73
            --stdout=/var/log/koha/$name/koha-indexer.log \
74
            --output=/var/log/koha/$name/koha-indexer-output.log \
75
            --verbose=1 --respawn --delay=30 \
76
            --user=$name-koha.$name-koha"
77
78
        log_daemon_msg "Restarting Koha indexing daemon for $name"
79
80
        if daemon $DAEMONOPTS --restart -- $INDEXDAEMON $INDEXDAEMON_OPTS; then
81
            log_end_msg 0
82
        else
83
            log_end_msg 1
84
        fi
85
    else
86
        log_daemon_msg "Error: Invalid instance name $name"
87
        log_end_msg 1
88
    fi
89
90
done
(-)a/debian/scripts/koha-start-indexer (+90 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# koha-start-indexer - Start Indexer Daemon for Koha instances
4
# Copyright 2012 Tomás Cohen Arazi @ Universidad Nacional de Córdoba
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
. /lib/lsb/init-functions
22
23
# Read configuration variable file if it is present
24
[ -r /etc/default/koha-common ] && . /etc/default/koha-common
25
26
if [[ $INDEXER_TIMEOUT != *[!0-9]* ]]; then
27
    INDEXER_TIMEOUT=30
28
fi
29
30
warn()
31
{
32
    echo "$@" 1>&2
33
}
34
35
is_instance()
36
{
37
    local instancename=$1
38
39
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
40
                         -type d -printf '%f\n'\
41
          | grep -q -x $instancename ; then
42
        return 0
43
    else
44
        return 1
45
    fi
46
}
47
48
INDEXDAEMON="koha-index-daemon"
49
export PERL5LIB="/usr/share/koha/lib"
50
51
if [ ! -e /usr/share/perl5/Koha/Contrib/Tamil/IndexerDaemon.pm ] ; then
52
    MSG=`cat <<EOF
53
Koha::Contrib::Tamil::IndexerDaemon was not found. See
54
http://wiki.koha-community.org/wiki/PackagesIndexDaemon
55
for instructions on setting up the indexer daemon.
56
EOF`
57
58
    warn $MSG
59
    exit;
60
fi
61
62
for name in "$@"
63
do
64
    if is_instance $name; then
65
        export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml"
66
67
        INDEXDAEMON_OPTS="--timeout $INDEXER_TIMEOUT \
68
                        --conf $KOHA_CONF \
69
                        --directory /var/tmp/koha-indexer-daemon-$name"
70
71
        DAEMONOPTS="--name=$name-koha-indexer \
72
            --errlog=/var/log/koha/$name/koha-indexer-error.log \
73
            --stdout=/var/log/koha/$name/koha-indexer.log \
74
            --output=/var/log/koha/$name/koha-indexer-output.log \
75
            --verbose=1 --respawn --delay=30 \
76
            --user=$name-koha.$name-koha"
77
78
        log_daemon_msg "Starting Koha indexing daemon for $name"
79
80
        if daemon $DAEMONOPTS -- $INDEXDAEMON $INDEXDAEMON_OPTS; then
81
            log_end_msg 0
82
        else
83
            log_end_msg 1
84
        fi
85
    else
86
        log_daemon_msg "Error: Invalid instance name $name"
87
        log_end_msg 1
88
    fi
89
90
done
(-)a/debian/scripts/koha-stop-indexer (-1 / +83 lines)
Line 0 Link Here
0
- 
1
#!/bin/sh
2
#
3
# koha-start-indexer - Stop Indexer Daemon for Koha instances
4
# Copyright 2012 Tomás Cohen Arazi @ Universidad Nacional de Córdoba
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
. /lib/lsb/init-functions
22
23
warn()
24
{
25
    echo "$@" 1>&2
26
}
27
28
is_instance()
29
{
30
    local instancename=$1
31
32
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
33
                         -type d -printf '%f\n'\
34
          | grep -q -x $instancename ; then
35
        return 0
36
    else
37
        return 1
38
    fi
39
}
40
41
INDEXDAEMON="koha-index-daemon"
42
export PERL5LIB="/usr/share/koha/lib"
43
44
if [ ! -e /usr/share/perl5/Koha/Contrib/Tamil/IndexerDaemon.pm ] ; then
45
    MSG=`cat <<EOF
46
Koha::Contrib::Tamil::IndexerDaemon was not found. See
47
http://wiki.koha-community.org/wiki/PackagesIndexDaemon
48
for instructions on setting up the indexer daemon.
49
EOF`
50
51
    warn $MSG
52
    exit;
53
fi
54
55
for name in "$@"
56
do
57
    if is_instance $name; then
58
        export KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml"
59
60
        INDEXDAEMON_OPTS="--timeout 30 \
61
                        --conf $KOHA_CONF \
62
                        --directory /var/tmp/koha-indexer-daemon-$name"
63
64
        DAEMONOPTS="--name=$name-koha-indexer \
65
            --errlog=/var/log/koha/$name/koha-indexer-error.log \
66
            --stdout=/var/log/koha/$name/koha-indexer.log \
67
            --output=/var/log/koha/$name/koha-indexer-output.log \
68
            --verbose=1 --respawn --delay=30 \
69
            --user=$name-koha.$name-koha"
70
71
        log_daemon_msg "Stopping Koha indexing daemon for $name"
72
73
        if daemon $DAEMONOPTS --stop -- $INDEXDAEMON $INDEXDAEMON_OPTS; then
74
            log_end_msg 0
75
        else
76
            log_end_msg 1
77
        fi
78
    else
79
        log_daemon_msg "Error: Invalid instance name $name"
80
        log_end_msg 1
81
    fi
82
83
done

Return to bug 8773