Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 358154 Details for
Bug 483786
net-nntp/sabnzbd: Improved init script for SABnzbd with fixes
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
New sabnzbd init script (diff against existing init script in 0.7.14)
sabnzbd.patch (text/plain), 3.38 KB, created by
eponymous
on 2013-09-07 11:15:05 UTC
(
hide
)
Description:
New sabnzbd init script (diff against existing init script in 0.7.14)
Filename:
MIME Type:
Creator:
eponymous
Created:
2013-09-07 11:15:05 UTC
Size:
3.38 KB
patch
obsolete
>@@ -1,7 +1,6 @@ > #!/sbin/runscript > # Copyright 1999-2013 Gentoo Foundation > # Distributed under the terms of the GNU General Public License v2 >-# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/files/sabnzbd.initd,v 1.5 2013/06/25 03:48:26 jsbronder Exp $ > > RUNDIR=/var/run/sabnzbd > >@@ -9,6 +8,35 @@ > need net > } > >+get_var() { >+ >+ echo $(sed -n '/\[misc]/,/'$1'/ s/'$1' = \([[:alnum:].]\+\)/\1/p' ${SABNZBD_CONFIGFILE}) >+} >+ >+get_port() { >+ >+ [[ $(get_var 'enable_https') == 1 ]] && echo $(get_var 'https_port') || echo $(get_var 'port') >+} >+ >+get_addr() { >+ >+ local host=$(get_var 'host') >+ local port=$(get_port) >+ local protocol >+ >+ [[ ${host} == "0.0.0.0" ]] && host=localhost >+ [[ $(get_var 'enable_https') == 1 ]] && protocol="https" || protocol="http" >+ >+ echo ${protocol}://${host}:${port} >+ >+} >+ >+get_pidfile() { >+ >+ local port=$(get_port) >+ echo "${RUNDIR}/sabnzbd-${port}.pid" >+} >+ > start() { > ebegin "Starting SABnzbd" > >@@ -20,76 +48,41 @@ > --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}" >+ --pid ${RUNDIR} > > eend $? > } > >-get_var() { >- echo $(echo $(grep "^$1" ${SABNZBD_CONFIGFILE} | head -n 1 | sed 's/\r//' | awk '{print $3}')) >-} >- >-get_pidfile () { >- # pid file name is hard-coded in sabnzbd, this must match >- local ssl=$(get_var 'enable_https') >- >- if [ -z "${ssl}" ]; then >- echo "${RUNDIR}/sabnzbd-8080.pid" >- elif [ ${ssl} -eq 0 ]; then >- echo "${RUNDIR}/sabnzbd-$(get_var 'port').pid" >- else >- echo "${RUNDIR}/sabnzbd-$(get_var 'https_port').pid" >- fi >-} >- >-get_addr() { >- local host=$(get_var 'host') >- #local ssl=$(get_var 'enable_https') >- #local ssl_port=$(get_var 'https_port') >- local port=$(get_var 'port') >- >- if [ "${host}" == "0.0.0.0" ]; then >- host=localhost >- fi >- >- # sabnzbd seems to only respond correctly to non ssl requests >- echo ${host}:${port} >-} > > stop() { > local api_key=$(get_var 'api_key') >- local rc t >+ local addr=$(get_addr) >+ local pidfile=$(get_pidfile) >+ local rc >+ >+ ebegin "Stopping SABnzbd" >+ >+ 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}") >+ [[ ${rc} == "ok" ]] && rc=0 || rc=1 > >- ebegin "Stopping SABnzbd @ $(get_addr)" >- >- /usr/bin/wget -q --delete-after --no-check-certificate \ >- "http://$(get_addr)/sabnzbd/api?mode=shutdown&apikey=${api_key}" >- rc=$? >- >- if [ ${rc} -eq 0 ]; then >- # Wait for sabnzbd to fully shutdown. >- for ((t=0; t < 30; t++)); do >- sleep 0.5 >- [ ! -s $(get_pidfile) ] && break >- done >- fi >- >- if [ -s $(get_pidfile) ]; then >- # Using wget didn't work, resort to start-stop-daemon >+ if [ ${rc} -eq 1 ]; then > einfo "Falling back to SIGTERM, this may not work if you restarted via the web interface" > start-stop-daemon \ > --stop \ >- --pidfile $(get_pidfile) \ >+ --pidfile ${pidfile} \ > --retry SIGTERM/1/SIGKILL/5 > rc=$? > fi > > 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 483786
:
357960
|
357962
|
358016
|
358020
|
358152
|
358154
|
358276
|
358278
|
358284
|
358286
|
358294
|
358296
|
358602
|
358604
|
360536
|
360558
|
360560
|
360600