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

(-)a/debian/docs/koha-email-disable.xml (-2 / +2 lines)
Lines 17-23 Link Here
17
17
18
  <refnamediv>
18
  <refnamediv>
19
    <refname>koha-email-disable</refname>
19
    <refname>koha-email-disable</refname>
20
    <refpurpose>Turn off the email for a Koha instance.</refpurpose>
20
    <refpurpose>Turn off the email for Koha instances.</refpurpose>
21
    <refclass>UNIX/Linux</refclass>
21
    <refclass>UNIX/Linux</refclass>
22
  </refnamediv>
22
  </refnamediv>
23
23
Lines 28-34 Link Here
28
  </refsynopsisdiv>
28
  </refsynopsisdiv>
29
29
30
  <refsect1><title>Description</title>
30
  <refsect1><title>Description</title>
31
  <para>Turn off the email for a Koha instance.</para>
31
  <para>Turn off the email for Koha instances.</para>
32
  </refsect1>
32
  </refsect1>
33
  
33
  
34
  <refsect1><title>See also</title>
34
  <refsect1><title>See also</title>
(-)a/debian/scripts/koha-email-disable (-13 / +69 lines)
Lines 1-6 Link Here
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
# koha-email-disable -- turn off the email for a Koha instance
3
# koha-email-disable - turn off the email for Koha instances
4
# Copyright 2010  Catalyst IT, Ltd
4
# Copyright 2010  Catalyst IT, Ltd
5
# 
5
# 
6
# This program is free software: you can redistribute it and/or modify
6
# This program is free software: you can redistribute it and/or modify
Lines 18-36 Link Here
18
18
19
set -e
19
set -e
20
20
21
if [ "$#" = 0 ]
21
die()
22
then
22
{
23
    echo "Disables the email for a koha instance." 1>&2
23
    echo "$@" 1>&2
24
    echo "Usage: $0 instancename..." 1>&2
25
    exit 1
24
    exit 1
26
fi
25
}
27
libdir=/var/lib/koha
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
56
disable_email()
57
{
58
    local instancename=$1
59
    local libdir="/var/lib/koha"
60
61
    rm -f $libdir/$instancename/email.enabled
62
63
    echo "Disabled email for instance $instancename."
64
}
65
66
usage()
67
{
68
    local scriptname=$0
69
    cat <<EOF
70
Disables the email for Koha instances.
71
72
Usage: $scriptname instancename1 instancename2...
73
74
EOF
75
}
76
77
# Parse command line.
78
[ $# -ge 1 ] || ( usage ; die "Missing instance name..." )
79
28
for name in "$@"
80
for name in "$@"
29
do
81
do
30
    if [ ! -d $libdir/$name ]
82
    if  is_instance $name; then
31
    then 
83
        if is_email_enabled $name; then
32
        echo "$0: no koha instance \"$name\"" 1>&2
84
            disable_email $name
33
        continue
85
        else
86
            warn "Email already disabled for instance $name."
87
        fi
88
    else
89
        warn "Unknown instance $name."
34
    fi
90
    fi
35
    rm -f $libdir/$name/email.enabled
36
done
91
done
37
- 
92
93
exit 0

Return to bug 10150