Page 1 of 1

FreeNAS shutdown script

Posted: October 12th, 2011, 5:02 pm
by Placemaster
I am trying to autostart and shutdown SABnzbd+ in FreeNAS.

The autostart function is working without problems. But the shutdown function reports constantly that the API key is not correct.
I have checked it 10 times and it is correct. Please find below the code I have used.

Code: Select all

#! /bin/bash

    ## CONFIG ##
    HOST="192.168.1.99"
    PORT="7777"
    MYAPI="b7f2fc75ed4a2b265ce3bac741e4680c"
    ## / CONFIG ##

    case "$1" in
    start)
    echo "Starting SABnzbd."

    /mnt/FreeNAS/Temp/SABnzbd-0.6.9/SABnzbd.py -d -f /mnt/FreeNAS/Temp/SABconfig/sabnzbd.ini
    ;;
    stop)
    echo "Shutting down SABnzbd."

    /usr/bin/fetch "http://192.168.1.99:7777/sabnzbd/shutdown?session=b7f2fc75ed4a2b265ce3bac741e4680c" >> /dev/null
    ;;
    *)
    echo "Usage: $0 {start|stop}"
    exit 1
    esac

    exit 0
I have also tried :

Code: Select all

/usr/bin/fetch http://$HOST:$PORT/sabnzbd/shutdown?session=$MYAPI
Any help is welocme.

Re: FreeNAS shutdown script

Posted: October 12th, 2011, 5:11 pm
by shypike
Don't use session, but apikey.
Also, I'm not sure about the quotes you are using here:
MYAPI="blabla"

Re: FreeNAS shutdown script

Posted: October 12th, 2011, 5:44 pm
by Placemaster
I tried your comments but it will not work.
Tomorrow I will continue with it as it is already 0:45.