Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 494640 | Differences between
and this patch

Collapse All | Expand All

(-)sabnzbd.initd?revision=1.7 (-7 / +11 lines)
Lines 82-95 Link Here
82
    local pidfile=$(get_pidfile)
82
    local pidfile=$(get_pidfile)
83
    local rc=1
83
    local rc=1
84
84
85
    ebegin "Stopping SABnzbd @ ${addr}"
85
    # This can only work if we have enabled the API
86
    if [ -n "${api_key}" ] && [ "$(get_var 'disable_api_key')" -ne 1 ]; then
86
87
87
    # SABnzbd will return "ok" if shutdown is successful
88
        einfo "Attempting web-based shutdown @ ${addr}"
88
    rc=$(/usr/bin/curl -k -s "${addr}/sabnzbd/api?mode=shutdown&apikey=${api_key}")
89
89
    if [ "${rc}" == "ok" ]; then
90
        # SABnzbd will return "ok" if shutdown is successful
90
		rc=0
91
        rc=$(/usr/bin/curl -k -s "${addr}/sabnzbd/api?mode=shutdown&apikey=${api_key}")
91
	else
92
        [[ "${rc}" == "ok" ]] && rc=0
92
        einfo "Falling back to SIGTERM, this may not work if you restarted via the web interface"
93
    fi
94
95
    if [ "${rc}" -eq 1 ]; then
96
        einfo "Shutting down via SIGTERM"
93
        start-stop-daemon \
97
        start-stop-daemon \
94
            --stop \
98
            --stop \
95
            --pidfile ${pidfile} \
99
            --pidfile ${pidfile} \

Return to bug 494640