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

(-)a/debian/scripts/koha-sip (-19 / +48 lines)
Lines 45-50 Usage: Link Here
45
$scriptname [--start|--stop|--restart] instancename1 [instancename2...]
45
$scriptname [--start|--stop|--restart] instancename1 [instancename2...]
46
$scriptname -h|--help
46
$scriptname -h|--help
47
47
48
    --enable              Enable the Koha SIP server with a default configuration
49
    --disable             Disable the Koha SIP server, backing up existent configurations.
48
    --start               Start the SIP server for the specified instance(s)
50
    --start               Start the SIP server for the specified instance(s)
49
    --stop                Stop the SIP server for the specified instance(s)
51
    --stop                Stop the SIP server for the specified instance(s)
50
    --restart             Restart the SIP server for the specified instance(s)
52
    --restart             Restart the SIP server for the specified instance(s)
Lines 62-78 start_sip() Link Here
62
    _check_and_fix_perms $name
64
    _check_and_fix_perms $name
63
65
64
    if ! is_sip_running $name; then
66
    if ! is_sip_running $name; then
65
67
        if [ ! -f "/etc/koha/sites/${name}/SIPconfig.xml" ] ; then
66
        adjust_paths_dev_install $name
68
            echo "SIP is disabled, or you do not have a SIPconfig.xml file."
67
        export KOHA_HOME PERL5LIB
68
69
        if [ "$DEV_INSTALL" = "" ]; then
70
            LIBDIR=$KOHA_HOME/lib
71
        else
69
        else
72
            LIBDIR=$KOHA_HOME
70
            adjust_paths_dev_install $name
73
        fi
71
            export KOHA_HOME PERL5LIB
74
72
75
        DAEMONOPTS="--name=${name}-koha-sip \
73
            if [ "$DEV_INSTALL" = "" ]; then
74
                LIBDIR=$KOHA_HOME/lib
75
            else
76
                LIBDIR=$KOHA_HOME
77
            fi
78
79
            DAEMONOPTS="--name=${name}-koha-sip \
76
                    --errlog=/var/log/koha/${name}/sip-error.log \
80
                    --errlog=/var/log/koha/${name}/sip-error.log \
77
                    --stdout=/var/log/koha/${name}/sip.log \
81
                    --stdout=/var/log/koha/${name}/sip.log \
78
                    --output=/var/log/koha/${name}/sip-output.log \
82
                    --output=/var/log/koha/${name}/sip-output.log \
Lines 82-99 start_sip() Link Here
82
                    --pidfiles=/var/run/koha/${name} \
86
                    --pidfiles=/var/run/koha/${name} \
83
                    --user=${name}-koha.${name}-koha"
87
                    --user=${name}-koha.${name}-koha"
84
88
85
        SIP_PARAMS="$LIBDIR/C4/SIP/SIPServer.pm \
89
            SIP_PARAMS="$LIBDIR/C4/SIP/SIPServer.pm \
86
                    /etc/koha/sites/${name}/SIPconfig.xml"
90
                    /etc/koha/sites/${name}/SIPconfig.xml"
87
91
88
        [ "$verbose" != "no" ] && \
92
            [ "$verbose" != "no" ] && \
89
            log_daemon_msg "Starting SIP server for ${name}"
93
                log_daemon_msg "Starting SIP server for ${name}"
90
94
91
        if daemon $DAEMONOPTS -- perl $SIP_PARAMS; then
95
            if daemon $DAEMONOPTS -- perl $SIP_PARAMS; then
92
            ([ "$verbose" != "no" ] && \
96
                ([ "$verbose" != "no" ] && \
93
                log_end_msg 0) || return 0
97
                    log_end_msg 0) || return 0
94
        else
98
            else
95
            ([ "$verbose" != "no" ] && \
99
                ([ "$verbose" != "no" ] && \
96
                log_end_msg 1) || return 1
100
                    log_end_msg 1) || return 1
101
            fi
97
        fi
102
        fi
98
    else
103
    else
99
        if [ "$verbose" != "no" ]; then
104
        if [ "$verbose" != "no" ]; then
Lines 189-194 enable_sip() Link Here
189
    fi
194
    fi
190
}
195
}
191
196
197
disable_sip()
198
{
199
    local name=$1
200
201
    sipfile=/etc/koha/sites/${name}/SIPconfig.xml
202
203
    if is_sip_enabled ${name}; then
204
        # SIP is enabled, we should disable it
205
        echo "Stopping running SIP"
206
        stop_sip ${name}
207
        echo "Disabling SIP server for ${name} - backing up ${sipfile} to ${sipfile}.bak to preserve configurations"
208
        mv ${sipfile} ${sipfile}.bak
209
        echo "Warning: SIP server disabled for ${name}"
210
    else
211
        echo " SIP server for ${name} not enabled - use koha-sip --enable <instance> to enable. Previous configurations available, if existent, in /etc/koha/sites/${name}/SIPconfig.xml.bak"
212
    fi
213
}
214
215
192
_check_and_fix_perms()
216
_check_and_fix_perms()
193
{
217
{
194
    local name=$1
218
    local name=$1
Lines 262-267 while [ $# -gt 0 ]; do Link Here
262
        --enable)
286
        --enable)
263
            set_action "enable"
287
            set_action "enable"
264
            shift ;;
288
            shift ;;
289
        --disable)
290
            set_action "disable"
291
            shift ;;
265
        -*)
292
        -*)
266
            die "Error: invalid option switch ($1)" ;;
293
            die "Error: invalid option switch ($1)" ;;
267
        *)
294
        *)
Lines 294-299 if [ $# -gt 0 ]; then Link Here
294
                    ;;
321
                    ;;
295
                "enable")
322
                "enable")
296
                    enable_sip $name
323
                    enable_sip $name
324
                    ;;
325
                "disable")
326
                    disable_sip $name
297
            esac
327
            esac
298
328
299
        else
329
        else
300
- 

Return to bug 24340