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

(-)a/debian/scripts/koha-create (-5 / +8 lines)
Lines 19-24 Link Here
19
19
20
set -e
20
set -e
21
21
22
# include helper functions
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
27
    exit 1
28
fi
29
22
usage()
30
usage()
23
{
31
{
24
    local scriptname=$0
32
    local scriptname=$0
Lines 63-73 Note: the instance name cannot be longer that 11 chars. Link Here
63
EOF
71
EOF
64
}
72
}
65
73
66
die() {
67
    echo "$@" 1>&2
68
    exit 1
69
}
70
71
# UPPER CASE VARIABLES - from configfile or default value
74
# UPPER CASE VARIABLES - from configfile or default value
72
# lower case variables - generated within this script
75
# lower case variables - generated within this script
73
generate_config_file() {
76
generate_config_file() {
(-)a/debian/scripts/koha-disable (-43 / +16 lines)
Lines 19-70 Link Here
19
19
20
set -e
20
set -e
21
21
22
22
# include helper functions
23
die()
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
{
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
    echo "$@" 1>&2
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
27
    exit 1
27
}
28
fi
28
29
warn()
30
{
31
    echo "$@" 1>&2
32
}
33
34
is_enabled()
35
{
36
    local instancename=$1
37
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
38
39
    if ! is_instance $instancename; then
40
        return 1
41
    fi
42
43
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
44
            "$instancefile" ; then
45
        return 1
46
    else
47
        return 0
48
    fi
49
}
50
29
51
is_instance()
30
disable_instance()
52
{
31
{
53
    local instancename=$1
32
    local site=$1
33
    local instancefile=$(get_apache_config_for $site)
54
34
55
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
35
    if [ "$instancefile" = ""]; then
56
                         -type d -printf '%f\n'\
36
        return 2
57
          | grep -q -x $instancename ; then
58
        return 0
59
    else
60
        return 1
61
    fi
37
    fi
62
}
63
64
disable_instance()
65
{
66
    local instancename=$1
67
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
68
38
69
    if is_enabled $instancename; then
39
    if is_enabled $instancename; then
70
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' \
40
        sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-disable.conf\)$:\1:' \
Lines 94-103 restart_apache="no" Link Here
94
for name in "$@"
64
for name in "$@"
95
do
65
do
96
    if is_instance $name ; then
66
    if is_instance $name ; then
97
        if disable_instance $name; then
67
        RET=$(disable_instance $name)
68
        if [ "$RET" = 0 ]; then
98
            restart_apache="yes"
69
            restart_apache="yes"
70
        elif [ "$RET" = 2 ]; then
71
            warn "Error: Apache configuration file not present for instance $name."
99
        else
72
        else
100
            warn "Instance $name already disabled."
73
            warn "Warning: instance $name already disabled."
101
        fi
74
        fi
102
    else
75
    else
103
        warn "Unknown instance $name."
76
        warn "Unknown instance $name."
(-)a/debian/scripts/koha-dump (-7 / +7 lines)
Lines 19-35 Link Here
19
19
20
set -e
20
set -e
21
21
22
# include helper functions
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
27
    exit 1
28
fi
22
29
23
# Make sure the files we create are not accessible by anyone else.
30
# Make sure the files we create are not accessible by anyone else.
24
umask 0077
31
umask 0077
25
32
26
27
die() {
28
    echo "$@" 1>&2
29
    exit 1
30
}
31
32
33
# Parse command line.
33
# Parse command line.
34
[ "$#" = 1 ] || die "Usage: $0 instancename"
34
[ "$#" = 1 ] || die "Usage: $0 instancename"
35
name="$1"
35
name="$1"
(-)a/debian/scripts/koha-email-disable (-33 / +6 lines)
Lines 18-57 Link Here
18
18
19
set -e
19
set -e
20
20
21
die()
21
# include helper functions
22
{
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    echo "$@" 1>&2
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
24
    exit 1
26
    exit 1
25
}
27
fi
26
27
warn()
28
{
29
    echo "$@" 1>&2
30
}
31
32
is_instance()
33
{
34
    local instancename=$1
35
36
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
37
                         -type d -printf '%f\n'\
38
          | grep -q -x $instancename ; then
39
        return 0
40
    else
41
        return 1
42
    fi
43
}
44
45
is_email_enabled()
46
{
47
    local instancename=$1
48
49
    if [ -e /var/lib/koha/$instancename/email.enabled ]; then
50
        return 0
51
    else
52
        return 1
53
    fi
54
}
55
28
56
disable_email()
29
disable_email()
57
{
30
{
(-)a/debian/scripts/koha-email-enable (-33 / +6 lines)
Lines 18-57 Link Here
18
18
19
set -e
19
set -e
20
20
21
die()
21
# include helper functions
22
{
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    echo "$@" 1>&2
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
24
    exit 1
26
    exit 1
25
}
27
fi
26
27
warn()
28
{
29
    echo "$@" 1>&2
30
}
31
32
is_instance()
33
{
34
    local instancename=$1
35
36
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
37
                         -type d -printf '%f\n'\
38
          | grep -q -x $instancename ; then
39
        return 0
40
    else
41
        return 1
42
    fi
43
}
44
45
is_email_enabled()
46
{
47
    local instancename=$1
48
49
    if [ -e /var/lib/koha/$instancename/email.enabled ]; then
50
        return 0
51
    else
52
        return 1
53
    fi
54
}
55
28
56
enable_email()
29
enable_email()
57
{
30
{
(-)a/debian/scripts/koha-enable (-40 / +6 lines)
Lines 19-65 Link Here
19
19
20
set -e
20
set -e
21
21
22
22
# include helper functions
23
die()
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
{
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
    echo "$@" 1>&2
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
27
    exit 1
27
}
28
fi
28
29
warn()
30
{
31
    echo "$@" 1>&2
32
}
33
34
is_enabled()
35
{
36
    local instancename=$1
37
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
38
39
    if ! is_instance $instancename; then
40
        return 1
41
    fi
42
43
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
44
            "$instancefile" ; then
45
        return 1
46
    else
47
        return 0
48
    fi
49
}
50
51
is_instance()
52
{
53
    local instancename=$1
54
55
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
56
                         -type d -printf '%f\n'\
57
          | grep -q -x $instancename ; then
58
        return 0
59
    else
60
        return 1
61
    fi
62
}
63
29
64
enable_instance()
30
enable_instance()
65
{
31
{
(-)a/debian/scripts/koha-functions.sh (+115 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# koha-functions.sh -- shared library of helper functions for koha-* scripts
4
# Copyright 2014 - Tomas Cohen Arazi
5
#                  Universidad Nacional de Cordoba
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20
21
die()
22
{
23
    echo "$@" 1>&2
24
    exit 1
25
}
26
27
warn()
28
{
29
    echo "$@" 1>&2
30
}
31
32
get_apache_config_for()
33
{
34
    local site=$1
35
    local sitefile="/etc/apache2/sites-available/$site"
36
37
    if is_instance $site; then
38
        if [ -f "$sitefile.conf" ]; then
39
            echo "$sitefile.conf"
40
        elif [ -f "$sitefile" ]; then
41
            echo "$sitefile"
42
        fi
43
    fi
44
}
45
46
is_enabled()
47
{
48
    local site=$1
49
    local instancefile=$(get_apache_config_for $site)
50
51
    if [ "$instancefile" = "" ]; then
52
        return 1
53
    fi
54
55
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
56
            "$instancefile" ; then
57
        return 1
58
    else
59
        return 0
60
    fi
61
}
62
63
is_instance()
64
{
65
    local instancename=$1
66
67
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
68
                         -type d -printf '%f\n'\
69
          | grep -q -x "$instancename" ; then
70
        return 0
71
    else
72
        return 1
73
    fi
74
}
75
76
is_email_enabled()
77
{
78
    local instancename=$1
79
80
    if [ -e /var/lib/koha/$instancename/email.enabled ]; then
81
        return 0
82
    else
83
        return 1
84
    fi
85
}
86
87
is_sip_enabled()
88
{
89
    local instancename=$1
90
91
    if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then
92
        return 0
93
    else
94
        return 1
95
    fi
96
}
97
98
is_zebra_running()
99
{
100
    local instancename=$1
101
102
    if daemon --name="$instancename-koha-zebra" \
103
            --user="$instancename-koha.$instancename-koha" \
104
            --running ; then
105
        return 0
106
    else
107
        return 1
108
    fi
109
}
110
111
get_instances()
112
{
113
    find /etc/koha/sites -mindepth 1 -maxdepth 1\
114
                         -type d -printf '%f\n' | sort
115
}
(-)a/debian/scripts/koha-list (-46 / +6 lines)
Lines 19-71 Link Here
19
19
20
set -e
20
set -e
21
21
22
die()
22
# include helper functions
23
{
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    echo "$@" 1>&2
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
25
    exit 1
27
    exit 1
26
}
28
fi
27
28
is_enabled()
29
{
30
    local instancename=$1
31
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
32
33
    if grep '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
34
            "$instancefile" > /dev/null
35
    then
36
        return 1
37
    else
38
        return 0
39
    fi
40
}
41
42
is_email_enabled()
43
{
44
    local instancename=$1
45
46
    if [ -e /var/lib/koha/$instancename/email.enabled ]; then
47
        return 0
48
    else
49
        return 1
50
    fi
51
}
52
53
is_sip_enabled()
54
{
55
    local instancename=$1
56
57
    if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then
58
        return 0
59
    else
60
        return 1
61
    fi
62
}
63
64
get_instances()
65
{
66
    find /etc/koha/sites -mindepth 1 -maxdepth 1\
67
                         -type d -printf '%f\n' | sort
68
}
69
29
70
show_instances()
30
show_instances()
71
{
31
{
(-)a/debian/scripts/koha-mysql (-3 / +6 lines)
Lines 21-30 set -e Link Here
21
21
22
umask 0077
22
umask 0077
23
23
24
die() {
24
# include helper functions
25
    echo "$@" 1>&2
25
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
26
    . "/usr/share/koha/bin/koha-functions.sh"
27
else
28
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
29
    exit 1
27
}
30
fi
28
31
29
[ "$#" = 1 ] || die "Usage: $0 instancename"
32
[ "$#" = 1 ] || die "Usage: $0 instancename"
30
name="$1"
33
name="$1"
(-)a/debian/scripts/koha-mysqlcheck (-3 / +6 lines)
Lines 21-30 set -e Link Here
21
21
22
umask 0077
22
umask 0077
23
23
24
die() {
24
# include helper functions
25
    echo "$@" 1>&2
25
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
26
    . "/usr/share/koha/bin/koha-functions.sh"
27
else
28
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
26
    exit 1
29
    exit 1
27
}
30
fi
28
31
29
# Parse command line.
32
# Parse command line.
30
if [ $# -lt 1 ]; then
33
if [ $# -lt 1 ]; then
(-)a/debian/scripts/koha-rebuild-zebra (-22 / +6 lines)
Lines 19-47 Link Here
19
19
20
set -e
20
set -e
21
21
22
die()
22
# include helper functions
23
{
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    echo "$@" 1>&2
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
25
    exit 1
27
    exit 1
26
}
28
fi
27
28
warn()
29
{
30
    echo "$@" 1>&2
31
}
32
33
is_instance()
34
{
35
    local instancename=$1
36
37
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
38
                         -type d -printf '%f\n'\
39
          | grep -q -x $instancename ; then
40
        return 0
41
    else
42
        return 1
43
    fi
44
}
45
29
46
toggle_biblios_only()
30
toggle_biblios_only()
47
{
31
{
(-)a/debian/scripts/koha-remove (-4 / +12 lines)
Lines 19-24 Link Here
19
19
20
set -e
20
set -e
21
21
22
# include helper functions
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
27
    exit 1
28
fi
29
22
args=$(getopt -l keep-mysql -o k -n $0 -- "$@")
30
args=$(getopt -l keep-mysql -o k -n $0 -- "$@")
23
eval set -- $args
31
eval set -- $args
24
while [ ! -z "$1" ]
32
while [ ! -z "$1" ]
Lines 35-41 NAMES="$@" Link Here
35
43
36
SITECONFDIR="/etc/koha/sites"
44
SITECONFDIR="/etc/koha/sites"
37
# There has to be a better way of excluding '.' from find. But this works.
45
# There has to be a better way of excluding '.' from find. But this works.
38
INSTANCES=`cd $SITECONFDIR && find . -type d -printf " %f" |sed s/\ .\ //`
46
INSTANCES=$(get_instances)
39
47
40
if [ -z $NAMES ] ; then
48
if [ -z $NAMES ] ; then
41
    echo "Please specify a Koha instance name. Your choices are:"
49
    echo "Please specify a Koha instance name. Your choices are:"
Lines 69-78 eof Link Here
69
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
77
    # If the daemon is not running already, we don't want to fail this loop. So bin the result code if this fails.
70
    koha-stop-zebra $name || /bin/true
78
    koha-stop-zebra $name || /bin/true
71
79
72
    instancefile="$name.conf"
80
    instancefile=$(get_apache_config_for $name)
73
81
74
    [ -f "/etc/apache2/sites-available/$instancefile" ]  && \
82
    [ -f "$instancefile" ]  && \
75
        rm "/etc/apache2/sites-available/$instancefile"
83
        rm "$instancefile"
76
    [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
84
    [ -f "/etc/koha/sites/$name/koha-conf.xml" ] && \
77
        rm "/etc/koha/sites/$name/koha-conf.xml"
85
        rm "/etc/koha/sites/$name/koha-conf.xml"
78
    [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
86
    [ -f "/etc/koha/sites/$name/zebra-biblios.cfg" ] && \
(-)a/debian/scripts/koha-reset-passwd (-5 / +6 lines)
Lines 19-30 Link Here
19
19
20
set -e
20
set -e
21
21
22
22
# include helper functions
23
die() {
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    echo "$@" 1>&2
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
25
    exit 1
27
    exit 1
26
}
28
fi
27
28
29
29
pwdigest() {
30
pwdigest() {
30
    echo -n "$1" |
31
    echo -n "$1" |
(-)a/debian/scripts/koha-restart-zebra (-52 / +6 lines)
Lines 18-76 Link Here
18
18
19
set -e
19
set -e
20
20
21
die()
21
# include helper functions
22
{
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    echo "$@" 1>&2
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
24
    exit 1
26
    exit 1
25
}
27
fi
26
27
warn()
28
{
29
    echo "$@" 1>&2
30
}
31
32
is_enabled()
33
{
34
    local instancename=$1
35
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
36
37
    if ! is_instance $instancename; then
38
        return 1
39
    fi
40
41
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
42
            "$instancefile" ; then
43
        return 1
44
    else
45
        return 0
46
    fi
47
}
48
49
is_instance()
50
{
51
    local instancename=$1
52
53
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
54
                         -type d -printf '%f\n'\
55
          | grep -q -x $instancename ; then
56
        return 0
57
    else
58
        return 1
59
    fi
60
}
61
62
is_zebra_running()
63
{
64
    local instancename=$1
65
66
    if daemon --name="$instancename-koha-zebra" \
67
            --user="$instancename-koha.$instancename-koha" \
68
            --running ; then
69
        return 0
70
    else
71
        return 1
72
    fi
73
}
74
28
75
restart_zebra_instance()
29
restart_zebra_instance()
76
{
30
{
(-)a/debian/scripts/koha-restore (-5 / +6 lines)
Lines 19-30 Link Here
19
19
20
set -e
20
set -e
21
21
22
22
# include helper functions
23
die() {
23
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
24
    echo "$@" 1>&2
24
    . "/usr/share/koha/bin/koha-functions.sh"
25
else
26
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
25
    exit 1
27
    exit 1
26
}
28
fi
27
28
29
29
# Parse command line.
30
# Parse command line.
30
[ "$#" = 2 ] || die "Usage: $0 sqldump configdump"
31
[ "$#" = 2 ] || die "Usage: $0 sqldump configdump"
(-)a/debian/scripts/koha-start-zebra (-77 / +28 lines)
Lines 18-107 Link Here
18
18
19
set -e
19
set -e
20
20
21
die()
21
# include helper functions
22
{
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    echo "$@" 1>&2
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
24
    exit 1
26
    exit 1
25
}
27
fi
26
27
warn()
28
{
29
    echo "$@" 1>&2
30
}
31
32
is_enabled()
33
{
34
    local instancename=$1
35
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
36
37
    if ! is_instance $instancename; then
38
        return 1
39
    fi
40
41
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
42
            "$instancefile" ; then
43
        return 1
44
    else
45
        return 0
46
    fi
47
}
48
49
is_instance()
50
{
51
    local instancename=$1
52
53
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
54
                         -type d -printf '%f\n'\
55
          | grep -q -x $instancename ; then
56
        return 0
57
    else
58
        return 1
59
    fi
60
}
61
62
is_zebra_running()
63
{
64
    local instancename=$1
65
66
    if daemon --name="$instancename-koha-zebra" \
67
            --user="$instancename-koha.$instancename-koha" \
68
            --running ; then
69
        return 0
70
    else
71
        return 1
72
    fi
73
}
74
28
75
start_zebra_instance()
29
start_zebra_instance()
76
{
30
{
77
    local instancename=$1
31
    local instancename=$1
78
32
79
    if is_enabled $instancename; then
33
    echo "Starting Zebra server for $instancename"
80
        echo "Starting Zebra server for $instancename"
34
    touch "/var/log/koha/$instancename/zebra-error.log" \
81
        touch "/var/log/koha/$instancename/zebra-error.log" \
35
        "/var/log/koha/$instancename/zebra.log" \
82
            "/var/log/koha/$instancename/zebra.log" \
36
        "/var/log/koha/$instancename/zebra-output.log"
83
            "/var/log/koha/$instancename/zebra-output.log"
37
    chown "$instancename-koha:$instancename-koha" \
84
        chown "$instancename-koha:$instancename-koha" \
38
        "/var/log/koha/$instancename/zebra-error.log" \
85
            "/var/log/koha/$instancename/zebra-error.log" \
39
        "/var/log/koha/$instancename/zebra.log" \
86
            "/var/log/koha/$instancename/zebra.log" \
40
        "/var/log/koha/$instancename/zebra-output.log"
87
            "/var/log/koha/$instancename/zebra-output.log"
41
    daemon \
88
        daemon \
42
        --name="$instancename-koha-zebra" \
89
            --name="$instancename-koha-zebra" \
43
        --errlog="/var/log/koha/$instancename/zebra-error.log" \
90
            --errlog="/var/log/koha/$instancename/zebra-error.log" \
44
        --stdout="/var/log/koha/$instancename/zebra.log" \
91
            --stdout="/var/log/koha/$instancename/zebra.log" \
45
        --output="/var/log/koha/$instancename/zebra-output.log" \
92
            --output="/var/log/koha/$instancename/zebra-output.log" \
46
        --verbose=1 \
93
            --verbose=1 \
47
        --respawn \
94
            --respawn \
48
        --delay=30 \
95
            --delay=30 \
49
        --user="$instancename-koha.$instancename-koha" \
96
            --user="$instancename-koha.$instancename-koha" \
50
        -- \
97
            -- \
51
        zebrasrv \
98
            zebrasrv \
52
        -v none,fatal,warn \
99
            -v none,fatal,warn \
53
        -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
100
            -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
54
        return 0 || \
101
        return 0
102
    else
103
        return 1
55
        return 1
104
    fi
105
}
56
}
106
57
107
usage()
58
usage()
(-)a/debian/scripts/koha-stop-zebra (-71 / +22 lines)
Lines 18-101 Link Here
18
18
19
set -e
19
set -e
20
20
21
die()
21
# include helper functions
22
{
22
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
23
    echo "$@" 1>&2
23
    . "/usr/share/koha/bin/koha-functions.sh"
24
else
25
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
24
    exit 1
26
    exit 1
25
}
27
fi
26
27
warn()
28
{
29
    echo "$@" 1>&2
30
}
31
32
is_enabled()
33
{
34
    local instancename=$1
35
    local instancefile="/etc/apache2/sites-available/$instancename.conf"
36
37
    if ! is_instance $instancename; then
38
        return 1
39
    fi
40
41
    if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-disable.conf' \
42
            "$instancefile" ; then
43
        return 1
44
    else
45
        return 0
46
    fi
47
}
48
49
is_instance()
50
{
51
    local instancename=$1
52
53
    if find /etc/koha/sites -mindepth 1 -maxdepth 1 \
54
                         -type d -printf '%f\n'\
55
          | grep -q -x $instancename ; then
56
        return 0
57
    else
58
        return 1
59
    fi
60
}
61
62
is_zebra_running()
63
{
64
    local instancename=$1
65
66
    if daemon --name="$instancename-koha-zebra" \
67
            --user="$instancename-koha.$instancename-koha" \
68
            --running ; then
69
        return 0
70
    else
71
        return 1
72
    fi
73
}
74
28
75
stop_zebra_instance()
29
stop_zebra_instance()
76
{
30
{
77
    local instancename=$1
31
    local instancename=$1
78
32
79
    if is_zebra_running $instancename; then
33
    echo "Stopping Zebra server for $instancename"
80
        echo "Stopping Zebra server for $instancename"
34
    daemon \
81
        daemon \
35
        --name="$instancename-koha-zebra" \
82
            --name="$instancename-koha-zebra" \
36
        --errlog="/var/log/koha/$instancename/zebra-error.log" \
83
            --errlog="/var/log/koha/$instancename/zebra-error.log" \
37
        --stdout="/var/log/koha/$instancename/zebra.log" \
84
            --stdout="/var/log/koha/$instancename/zebra.log" \
38
        --output="/var/log/koha/$instancename/zebra-output.log" \
85
            --output="/var/log/koha/$instancename/zebra-output.log" \
39
        --verbose=1 \
86
            --verbose=1 \
40
        --respawn \
87
            --respawn \
41
        --delay=30 \
88
            --delay=30 \
42
        --user="$instancename-koha.$instancename-koha" \
89
            --user="$instancename-koha.$instancename-koha" \
43
        --stop \
90
            --stop \
44
        -- \
91
            -- \
45
        zebrasrv \
92
            zebrasrv \
46
        -v none,fatal,warn \
93
            -v none,fatal,warn \
47
        -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
94
            -f "/etc/koha/sites/$instancename/koha-conf.xml" && \
48
        return 0 || \
95
        return 0
96
    else
97
        return 1
49
        return 1
98
    fi
99
}
50
}
100
51
101
usage()
52
usage()
(-)a/debian/scripts/koha-translate (-7 / +8 lines)
Lines 20-25 Link Here
20
20
21
set -e
21
set -e
22
22
23
# include helper functions
24
if [ -f "/usr/share/koha/bin/koha-functions.sh" ]; then
25
    . "/usr/share/koha/bin/koha-functions.sh"
26
else
27
    echo "Error: /usr/share/koha/bin/koha-functions.sh not present." 1>&2
28
    exit 1
29
fi
30
23
usage()
31
usage()
24
{
32
{
25
    local scriptname=$(basename $0)
33
    local scriptname=$(basename $0)
Lines 50-61 $scriptname --help|-h Link Here
50
EOF
58
EOF
51
}
59
}
52
60
53
die()
54
{
55
    echo "$@" 1>&2
56
    exit 1
57
}
58
59
list()
61
list()
60
{
62
{
61
    all=$1
63
    all=$1
62
- 

Return to bug 11404