Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 366504 Details for
Bug 494640
net-nntp/sabnzbd - sabnzbd.initd: re-work stop() procedure and general tidy-ups
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Diff against revision 1.7 of initd script.
sabnzbd.initd.patch (text/plain), 4.16 KB, created by
eponymous
on 2013-12-29 23:30:07 UTC
(
hide
)
Description:
Diff against revision 1.7 of initd script.
Filename:
MIME Type:
Creator:
eponymous
Created:
2013-12-29 23:30:07 UTC
Size:
4.16 KB
patch
obsolete
>--- sabnzbd.initd.1.7 2013-12-29 23:26:56.319138600 +0000 >+++ sabnzbd 2013-12-29 23:26:44.242494495 +0000 >@@ -2,100 +2,99 @@ > # Copyright 1999-2013 Gentoo Foundation > # Distributed under the terms of the GNU General Public License v2 > >-RUNDIR=/var/run/sabnzbd >+RUNDIR='/var/run/sabnzbd' > > depend() { >- need net >+ need net > } > > get_var() { >- echo $(sed -n \ >- '/^\[misc]/,/^'$1'/ s/^'$1' = \([[:alnum:].]\+\)[\r|\n|\r\n]*$/\1/p' \ >- ${SABNZBD_CONFIGFILE}) >+ echo $(sed -n \ >+ '/^\[misc]/,/^'$1'/ s/^'$1' = \([[:alnum:].]\+\)[\r|\n|\r\n]*$/\1/p' \ >+ "${SABNZBD_CONFIGFILE}") > } > > get_port() { >- if [ "$(get_var 'enable_https')" == "1" ]; then >- echo $(get_var 'https_port') >- else >- echo $(get_var 'port') >- fi >+ if [ "$(get_var 'enable_https')" -eq 1 ]; then >+ echo $(get_var 'https_port') >+ else >+ echo $(get_var 'port') >+ fi > } > > get_addr() { >- local host=$(get_var 'host') >- local port=$(get_port) >- local protocol >- >- [ "${host}" == "0.0.0.0" ] && host=localhost >- if [ "$(get_var 'enable_https')" == "1" ]; then >- protocol="https" >- else >- protocol="http" >- fi >+ local host="$(get_var 'host')" >+ local protocol='http' > >- echo ${protocol}://${host}:${port} >+ [[ "${host}" == '0.0.0.0' ]] && host='localhost' >+ >+ [[ "$(get_var 'enable_https')" -eq 1 ]] && protocol='https' >+ >+ echo "${protocol}://${host}:$(get_port)" > } > > get_pidfile() { >- local port=$(get_port) >- echo "${RUNDIR}/sabnzbd-${port}.pid" >+ echo "${RUNDIR}/sabnzbd-$(get_port).pid" > } > >-start() { >- ebegin "Starting SABnzbd" >+start_pre() { >+ if [ "${RC_CMD}" == 'restart' ]; then >+ while [ -e "$(get_pidfile)" ]; do >+ sleep 1 >+ done >+ fi > >- checkpath -q -d -o ${SABNZBD_USER}:${SABNZBD_GROUP} -m 0770 "${RUNDIR}" >+ return 0 >+} > >- start-stop-daemon \ >- --quiet \ >- --start \ >- --user ${SABNZBD_USER} \ >- --group ${SABNZBD_GROUP} \ >- --name sabnzbd \ >- --background \ >- --pidfile $(get_pidfile) \ >- --exec /usr/bin/sabnzbd \ >- -- \ >- --config-file ${SABNZBD_CONFIGFILE} \ >- --logging ${SABNZBD_LOGGING} \ >- --daemon \ >- --pid ${RUNDIR} >+start() { >+ ebegin "Starting SABnzbd" > >- eend $? >-} >+ checkpath -q -d -o "${SABNZBD_USER}":"${SABNZBD_GROUP}" -m 0770 "${RUNDIR}" > >-start_pre() { >- if [ "$RC_CMD" == "restart" ]; then >- local pidfile=$(get_pidfile) >- while [ -e ${pidfile} ]; do >- sleep 1 >- done >- fi >+ start-stop-daemon \ >+ --quiet \ >+ --start \ >+ --user "${SABNZBD_USER}" \ >+ --group "${SABNZBD_GROUP}" \ >+ --name sabnzbd \ >+ --background \ >+ --pidfile "$(get_pidfile)" \ >+ --exec /usr/bin/sabnzbd \ >+ -- \ >+ --config-file "${SABNZBD_CONFIGFILE}" \ >+ --logging "${SABNZBD_LOGGING}" \ >+ --daemon \ >+ --pid "${RUNDIR}" > >- return 0 >+ eend "$?" > } > > stop() { >- local api_key=$(get_var 'api_key') >- local addr=$(get_addr) >- local pidfile=$(get_pidfile) >- local rc=1 >+ local api_key="$(get_var 'api_key')" >+ local addr="$(get_addr)" >+ local rc=1 >+ >+ ebegin "Stopping SABnzbd" >+ >+ # This can only work if we have enabled the API >+ if [ -n "${api_key}" ] && [ "$(get_var 'disable_api_key')" -ne 1 ]; then > >- ebegin "Stopping SABnzbd @ ${addr}" >+ einfo "Attempting web-based shutdown @ ${addr}" > > # SABnzbd will return "ok" if shutdown is successful >- rc=$(/usr/bin/curl -k -s "${addr}/sabnzbd/api?mode=shutdown&apikey=${api_key}") >- if [ "${rc}" == "ok" ]; then >- rc=0 >- else >- einfo "Falling back to SIGTERM, this may not work if you restarted via the web interface" >- start-stop-daemon \ >- --stop \ >- --pidfile ${pidfile} \ >- --retry SIGTERM/1/SIGKILL/5 >- rc=$? >- fi >+ [[ $(/usr/bin/curl -k -s "${addr}/sabnzbd/api?mode=shutdown&apikey=${api_key}") == 'ok' ]] && rc=0 >+ >+ fi >+ >+ if [ "${rc}" -eq 1 ]; then >+ einfo "Falling back to SIGTERM. NOTE: May not work if you restarted via the web interface." >+ start-stop-daemon \ >+ --stop \ >+ --pidfile "$(get_pidfile)" \ >+ --retry SIGTERM/1/SIGKILL/5 >+ rc="$?" >+ fi > >- eend ${rc} >+ eend "${rc}" > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 494640
:
365582
|
365584
|
365586
|
365588
|
365628
|
366486
|
366488
|
366498
|
366500
|
366504
|
378530