diff options
author | Steve Wills <swills@FreeBSD.org> | 2013-05-27 01:28:29 +0000 |
---|---|---|
committer | Steve Wills <swills@FreeBSD.org> | 2013-05-27 01:28:29 +0000 |
commit | dbac5fdf8a0e8cf62df0fd90806e6834a367557e (patch) | |
tree | 441a5f42bc454efc4ea0c4f1bcb1d96f607fe5d3 /news | |
parent | a0dd724fb09b9ee104f7e72876cc9982d621b0c5 (diff) | |
download | ports-dbac5fdf8a0e8cf62df0fd90806e6834a367557e.tar.gz ports-dbac5fdf8a0e8cf62df0fd90806e6834a367557e.zip |
Notes
Diffstat (limited to 'news')
-rw-r--r-- | news/sabnzbdplus/Makefile | 2 | ||||
-rw-r--r-- | news/sabnzbdplus/distinfo | 4 | ||||
-rw-r--r-- | news/sabnzbdplus/files/sabnzbd.in | 93 |
3 files changed, 47 insertions, 52 deletions
diff --git a/news/sabnzbdplus/Makefile b/news/sabnzbdplus/Makefile index c8f77a392580..49e432a98b32 100644 --- a/news/sabnzbdplus/Makefile +++ b/news/sabnzbdplus/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= sabnzbdplus -PORTVERSION= 0.7.11 +PORTVERSION= 0.7.12 CATEGORIES= news MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTVERSION} DISTNAME= SABnzbd-${PORTVERSION}-src diff --git a/news/sabnzbdplus/distinfo b/news/sabnzbdplus/distinfo index 6e201107d168..fb8d5ffbd5bb 100644 --- a/news/sabnzbdplus/distinfo +++ b/news/sabnzbdplus/distinfo @@ -1,2 +1,2 @@ -SHA256 (SABnzbd-0.7.11-src.tar.gz) = de9c22377e89b081b7c264993c159588acb86206d1b82a465554e2f9df39b311 -SIZE (SABnzbd-0.7.11-src.tar.gz) = 2273355 +SHA256 (SABnzbd-0.7.12-src.tar.gz) = 9763414af2b3b9eccf933d01dfe5404845aa4b2a5ce6b63c643fc5cb45d2fb9b +SIZE (SABnzbd-0.7.12-src.tar.gz) = 2275110 diff --git a/news/sabnzbdplus/files/sabnzbd.in b/news/sabnzbdplus/files/sabnzbd.in index ae657f654381..0ca329b0fce4 100644 --- a/news/sabnzbdplus/files/sabnzbd.in +++ b/news/sabnzbdplus/files/sabnzbd.in @@ -1,5 +1,7 @@ #!/bin/sh # +# $FreeBSD$ +# # PROVIDE: sabnzbd # KEYWORD: shutdown # @@ -22,70 +24,63 @@ . /etc/rc.subr -name="sabnzbd" +name=sabnzbd rcvar=sabnzbd_enable - -# Required, for some reason, to find all our binaries when starting via service. -PATH="%%PREFIX%%/bin:$PATH" - load_rc_config ${name} -: ${sabnzbd_enable:="NO"} -: ${sabnzbd_user:="_sabnzbd"} -: ${sabnzbd_group:="_sabnzbd"} -: ${sabnzbd_conf_dir:="%%PREFIX%%/sabnzbd"} +: ${sabnzbd_enable:=NO} +: ${sabnzbd_user:=_sabnzbd} +: ${sabnzbd_group:=_sabnzbd} +: ${sabnzbd_conf_dir="%%PREFIX%%/sabnzbd"} required_dirs=${sabnzbd_conf_dir} start_cmd="${name}_start" -#start_postcmd="${name}_poststart" status_cmd="${name}_status" stop_cmd="${name}_stop" start_precmd=sabnzbd_check_dir - - sabnzbd_start() { -if [ ! -f "${sabnzbd_pid}" ]; then - su -m ${sabnzbd_user} -c "%%PREFIX%%/bin/SABnzbd.py --daemon -f ${sabnzbd_conf_dir}/sabnzbd.ini" - echo "Starting ${name}." -else - GETPROCESSPID=`/bin/ps -auxw | /usr/bin/awk '/SABnzbd.py/ && !/awk/ && !/sh/ {print $2}'` - PIDFROMFILE=`cat ${sabnzbd_pid}` - if [ "$GETPROCESSPID" = "$PIDFROMFILE" ]; then - echo "${name} already running with PID: ${PIDFROMFILE} ?" - echo "Remove ${sabnzbd_pid} manually if needed." - else - rm -f ${sabnzbd_pid} - su -m ${sabnzbd_user} -c "%%PREFIX%%/bin/SABnzbd.py --daemon -f ${sabnzbd_conf_dir}/sabnzbd.ini" - echo "Starting ${name}." - fi -fi + if [ ! -f "${sabnzbd_pid}" ]; then + su -m ${sabnzbd_user} -c "%%PREFIX%%/bin/SABnzbd.py --daemon -f ${sabnzbd_conf_dir}/sabnzbd.ini" + echo "Starting ${name}." + else + GETPROCESSPID=`/bin/ps -auxw | /usr/bin/awk '/SABnzbd.py/ && !/awk/ && !/sh/ {print $2}'` + PIDFROMFILE=`cat ${sabnzbd_pid}` + if [ "$GETPROCESSPID" = "$PIDFROMFILE" ]; then + echo "${name} already running with PID: ${PIDFROMFILE} ?" + echo "Remove ${sabnzbd_pid} manually if needed." + else + rm -f ${sabnzbd_pid} + su -m ${sabnzbd_user} -c "%%PREFIX%%/bin/SABnzbd.py --daemon -f ${sabnzbd_conf_dir}/sabnzbd.ini" + echo "Starting ${name}." + fi + fi } -#sabnzbd_poststart() { -# echo `/bin/ps -auxw | /usr/bin/awk '/SABnzbd.py/ && !/awk/ {print $2}'` > $sabnzbd_pid -#} - # SABnzbd can only be cleanly stopped by calling the http api -sabnzbd_stop() { - echo "Stopping $name" - if [ -f "${sabnzbd_conf_dir}/sabnzbd.ini" ]; then - apikey=`grep ^api_key ${sabnzbd_conf_dir}/sabnzbd.ini | tr -d " _"` - host=`grep -m1 -E '^host\ =\ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9].'` - if [ ${host} = "0.0.0.0" ] ; then host="localhost" ; fi - port=`grep -m1 ^port ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9]'` - fetch -o /dev/null "http://${host}:${port}/api?mode=shutdown&${apikey}" > /dev/null 2>&1 - else - sabnzbd_pid=`ps -U ${sabnzbd_user} | grep "python.*SABnzbd.py.*--daemon" | grep -v 'grep' | awk '{print $1}'` - if [ -n "${sabnzbd_pid}" ]; then - kill ${sabnzbd_pid} - fi - fi +sabnzbd_stop() +{ + echo "Stopping $name" + if [ -f "${sabnzbd_conf_dir}/sabnzbd.ini" ]; then + apikey=`grep ^api_key ${sabnzbd_conf_dir}/sabnzbd.ini | tr -d " _"` + host=`grep -m1 -E '^host\ =\ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9].'` + if [ ${host} = "0.0.0.0" ] ; then + host="localhost" ; + fi + port=`grep -m1 ^port ${sabnzbd_conf_dir}/sabnzbd.ini | tr -dc '[0-9]'` + fetch -o /dev/null "http://${host}:${port}/api?mode=shutdown&${apikey}" > /dev/null 2>&1 + else + sabnzbd_pid=`ps -U ${sabnzbd_user} | grep "python.*SABnzbd.py.*--daemon" | grep -v 'grep' | awk '{print $1}'` + if [ -n "${sabnzbd_pid}" ]; then + kill ${sabnzbd_pid} + fi + fi } -sabnzbd_status() { +sabnzbd_status() +{ sabnzbd_pid=`ps -U ${sabnzbd_user} | grep "python.*SABnzbd.py.*--daemon" | grep -v 'grep' | awk '{print $1}'` if [ -n "${sabnzbd_pid}" ]; then echo "$name is running as ${sabnzbd_pid}" @@ -94,10 +89,10 @@ sabnzbd_status() { fi } -sabnzbd_check_dir() { +sabnzbd_check_dir() +{ if [ ! -f "${required_dirs}" -a ! -d "${required_dirs}" -a ! -L "${required_dirs}" ]; then - mkdir -p ${required_dirs} - chown ${sabnzbd_user}:${sabnzbd_group} ${required_dirs} + install -d -o ${sabnzbd_user} -g ${sabnzbd_group} ${required_dirs} fi } |