Page 1 of 1

SAB HTTP port overwritten by HTTPS port

Posted: December 22nd, 2014, 5:01 pm
by alanspa
I have configured my SAB to use port 8080 for HTTP, and 9090 for HTTPS. However, after I restart my SAB machine (Debian wheezy) the HTTP port is overwritten with port 9090 (which is what the HTTPS port was configured as). As a result the HTTPS port is not being listened on (as it is being used by HTTP) and I am unable to connect securely. I have rebuilt my SAB from scratch (clean wheezy install) and it keeps on happening. Anyone else seen this?

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 23rd, 2014, 10:14 am
by sander
What is your output of:

Code: Select all

cat ~/.sabnzbd/logs/sabnzbd.log | grep -e 8080 -e 9090 | tail -5
cat ~/.sabnzbd/sabnzbd.ini | grep -e 8080 -e 9090
Mine:

Code: Select all

sander@flappie:~$ cat ~/.sabnzbd/logs/sabnzbd.log | grep -e 8080 -e 9090 | tail -5
2014-12-22 19:08:42,780::INFO::[_cplogging:55] [22/Dec/2014:19:08:42] ENGINE Serving on 0.0.0.0:9090
2014-12-22 19:08:42,982::INFO::[_cplogging:55] [22/Dec/2014:19:08:42] ENGINE Serving on 0.0.0.0:8080
2014-12-23 09:15:18,370::INFO::[sabnzbdplus:1516] Starting web-interface on 0.0.0.0:9090
2014-12-23 09:15:18,577::INFO::[_cplogging:55] [23/Dec/2014:09:15:18] ENGINE Serving on 0.0.0.0:9090
2014-12-23 09:15:18,679::INFO::[_cplogging:55] [23/Dec/2014:09:15:18] ENGINE Serving on 0.0.0.0:8080
sander@flappie:~$ 
sander@flappie:~$ 
sander@flappie:~$ cat ~/.sabnzbd/sabnzbd.ini | grep -e 8080 -e 9090
https_port = 9090
port = 8080
sander@flappie:~$

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 2:04 am
by alanspa
Here's my output. Note that this is taken after I have re-entered the values that I want (i.e. port 8080 for HTTP and 9090 for HTTPS), but after a reboot the HTTP port will be replaced with the HTTPS port (as described above) and then I have to re-enter the values again to get it working as expected.

Code: Select all

cat ~ .sabnzbd/logs/sabnzbd.log | grep -e 8080 -e 9090 | tail -5
cat: /root: Is a directory
2014-12-23 11:45:23,003::INFO::[SABnzbd:1528] Starting web-interface on 0.0.0.0:9090
2014-12-23 11:45:23,226::INFO::[_cplogging:55] [23/Dec/2014:11:45:23] ENGINE Serving on 0.0.0.0:8080
2014-12-23 11:45:23,327::INFO::[_cplogging:55] [23/Dec/2014:11:45:23] ENGINE Serving on ::1:8080
2014-12-23 11:45:23,428::INFO::[_cplogging:55] [23/Dec/2014:11:45:23] ENGINE Serving on ::1:9090
2014-12-23 11:45:23,530::INFO::[_cplogging:55] [23/Dec/2014:11:45:23] ENGINE Serving on 0.0.0.0:9090
and

Code: Select all

cat ~ .sabnzbd/sabnzbd.ini | grep -e 8080 -e 9090
cat: /root: Is a directory
https_port = 9090
port = 8080

EDIT:
Here's the output after a reboot:

Code: Select all

cat ~ .sabnzbd/logs/sabnzbd.log | grep -e 8080 -e 9090 | tail -5
cat: /root: Is a directory
2014-12-23 11:45:23,530::INFO::[_cplogging:55] [23/Dec/2014:11:45:23] ENGINE Serving on 0.0.0.0:9090
2014-12-24 09:14:54,522::INFO::[SABnzbd:1277] Arguments = SABnzbd.py --daemon --pidfile /var/run/sabnzbd/sabnzbd.pid --config-file /home/sabnzbd/.sabnzbd/sabnzbd.ini --server 0.0.0.0:9090
2014-12-24 09:14:54,869::INFO::[SABnzbd:1528] Starting web-interface on 0.0.0.0:9090
2014-12-24 09:14:55,016::INFO::[_cplogging:55] [24/Dec/2014:09:14:55] ENGINE Serving on ::1:9090
2014-12-24 09:14:55,117::INFO::[_cplogging:55] [24/Dec/2014:09:14:55] ENGINE Serving on 0.0.0.0:9090

Code: Select all

cat ~ .sabnzbd/sabnzbd.ini | grep -e 8080 -e 9090
cat: /root: Is a directory
https_port = 9090
port = 9090

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 3:37 am
by sander
Why is that line " --server 0.0.0.0:9090" in your command line? Let's find out:

Post the output of:

Code: Select all

cat /etc/default/sabnzbdplus
here in this thread

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 3:54 am
by alanspa
I don't have such a file in the /etc/default directory.

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 3:59 am
by sander
alanspa wrote:I don't have such a file in the /etc/default directory.
If so, how do you start SABnzbd?

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 4:10 am
by alanspa
Reading through my initial post I realised that I failed to mention that my SAB install is part of OpenMediaVault. Sorry if this is a major omission (I thought SAB is SAB whether part of OMV or not). So, to answer your question, SAB starts as part of OMV.

Re: SAB HTTP port overwritten by HTTPS port [OpenMediaVault]

Posted: December 24th, 2014, 4:24 am
by sander
I see. Let's discover which files are there ... what is the output of

Code: Select all

cat /etc/init.d/sabnzbd
resp

Code: Select all

cat /etc/init.d/sabnzbdplus
Post the full output here, enclosed in CODE brackets.

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 4:34 am
by alanspa
I can repeat the behaviour by stopping and starting the SAB service.
1. Check the sabnzbd.ini file before stopping the service. All ports are as configured, and enable_https =1.
2. Stop the service.
3. Start service. HTTP port in sabnzbd.ini changes to the same as HTTPS port, and enable_https parameter has changed from 1 to 0.

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 24th, 2014, 4:39 am
by alanspa
Here's the output of cat /etc/init.d/sabnzbd:

Code: Select all

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:          sabnzbdplus
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Should-Start:      NetworkManager
# Should-Stop:       NetworkManager
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: SABnzbd+ binary newsgrabber
### END INIT INFO

############### EDIT ME ##################
# Path to store PID file
PID_FILE=/var/run/sabnzbd/sabnzbd.pid
PID_PATH=/var/run/sabnzbd

# script name
NAME=sabnzbd
DESC=SABnzbd
# startup args
DAEMON_OPTS="--daemon --pidfile $PID_FILE"
EXTRA_OPTS=""
RUN_AS=sabnzbd
DAEMON=SABnzbd.py
APP_PATH=/opt/SABnzbd
CONFIG="/home/sabnzbd/.sabnzbd/sabnzbd.ini"
HOST="0.0.0.0"

if [ -f $CONFIG ]; then
        #HOST=`grep -m 1 ^host $CONFIG | cut -d ' ' -f 3` Not needed ?
    if [ `grep -m 1 ^enable_https $CONFIG | cut -d ' ' -f 3` == "1" ]; then
                PORT=`grep ^https_port $CONFIG | cut -d ' ' -f 3`
        else
                PORT=`grep -m 1 ^port $CONFIG | cut -d ' ' -f 3`
        fi
else
        PORT="8080"
fi
############### END EDIT ME ##################

test -x $APP_PATH/$DAEMON || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

set -e

if [ ! -d $PID_PATH ]; then
    mkdir -p $PID_PATH
        chown -R $RUN_AS:users $PID_PATH
fi

if [ ! -d /home/sabnzbd/.sabnzbd ]; then
    mkdir -p /home/sabnzbd/.sabnzbd
        chown -R $RUN_AS:users /home/sabnzbd/.sabnzbd
fi

if [ -e $PID_FILE ]; then
    PID=`cat $PID_FILE`
    if ! kill -0 $PID > /dev/null 2>&1; then
        echo "Removing stale $PID_FILE"
        rm $PID_FILE
    fi
fi

load_settings()
{
    HOST="0.0.0.0"
        #Set SABnzbd address here.
    EXTRAOPTS=""
    OPTIONS="$DAEMON_OPTS"
    OPTIONS="$OPTIONS --config-file $CONFIG $EXTRA_OPTS"
    SERVER="$HOST"
    SERVER="$SERVER:$PORT"
    OPTIONS="$OPTIONS --server $SERVER"
    OPTIONS="$OPTIONS $EXTRAOPTS"
}

is_running()
{
    if [ ! -e $PID_FILE ]; then
        return 1
    fi
    return 0
}

case "$1" in
    start)
        echo "Starting $DESC"
        load_settings;
        cd $APP_PATH
        start-stop-daemon -d $APP_PATH -c $RUN_AS --start --exec $DAEMON -- $OPTIONS
        ;;

    stop)
        if is_running; then
            echo "Stopping $DESC"
            start-stop-daemon --stop --pidfile $PID_FILE --retry 15
        fi
        ;;

    restart|force-reload)
        if is_running; then
            start-stop-daemon --stop --pidfile $PID_FILE --retry 15
        fi
        echo "Restarting $DESC"
        load_settings;
        cd $APP_PATH
        start-stop-daemon -d $APP_PATH -c $RUN_AS --start --exec $DAEMON -- $OPTIONS
        ;;

    status)
        status_of_proc -p $PID_FILE "$DAEMON" "$NAME"
        ;;

    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|status|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
and the results of sabnzbdplus:

Code: Select all

cat /etc/init.d/sabnzbdplus
cat: /etc/init.d/sabnzbdplus: No such file or directory

Re: SAB HTTP port overwritten by HTTPS port

Posted: December 26th, 2014, 4:02 pm
by sander
Sorry ... that's too much shell scripting for me ... trying to correct it would be trial-and-error from my side.