New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

[SOLVED] SABnzbdplus / Shell question

Got problems with your B2 or B3? Share and get helped!
Post Reply
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

[SOLVED] SABnzbdplus / Shell question

Post by Binkem »

Hi all,

Today I found that SABnzbdplus was not running anymore on my B3. This may (or may not) be related to my restarting Apache2 last week.
When I tried to restart the service using the shell script:

Code: Select all

case "$1" in
start)
echo "Starting SABnzbd."
/usr/bin/sudo -u ###### -H /opt/SABnzbd-0.7.17/SABnzbd.py -d -f /home/######/.sabnzbd/sabnzbd.ini
;;
stop)
echo "Shutting down SABnzbd."
/usr/bin/wget -q --delete-after "http://localhost:8080/sabnzbd/api?mode=shutdown&apikey=############
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

exit 0
I get the following error:
root@bubba:/home/martijn# /etc/init.d/sabnzbdplus stop
'etc/init.d/sabnzbdplus: line 1: syntax error near unexpected token `in
'etc/init.d/sabnzbdplus: line 1: `case "$1" in
I managed to start the service using the command in the script.

Can anyone explain why the script doesn't work? (It did work until now).

Martijn
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: SABnzbdplus / Shell question

Post by Ubi »

just for fun, can you add the line

Code: Select all

#!/bin/bash
at the top of your script?

Also, is there any chance you edited this file in windows?
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: SABnzbdplus / Shell question

Post by Binkem »

Hi Ubi,

Adding the line doesn't change anything.

I may have copied the script using the conTEXT editor on my Windows laptop. When saving after editing in Nano is states: File name to write [DOS Format]:

With some help from Google I managed to remove DOs-formatting (just press ALT-D when saving in Nano). Now it works again.

Thanks for the hints.

Martijn
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: [SOLVED] SABnzbdplus / Shell question

Post by Ubi »

Ok, so the \r\n line endings did you in. Next time, run dos2unix on your file to remove these.

Oddly, you suggested that you did not alter the script (and it worked begore and not now), but now you mention that you did edit it in conTEXT. Thats a bit of a contradiction???
Gordon
Posts: 1462
Joined: 10 Aug 2011, 03:18

Re: [SOLVED] SABnzbdplus / Shell question

Post by Gordon »

Ah yes. If I would get a nickel for every time people told me they didn't change anything I'd be a very wealthy man indeed.
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: [SOLVED] SABnzbdplus / Shell question

Post by Ubi »

Hey, if they always solved their own problems instead of creating them you'd be unemployed instead! :D
Binkem
Posts: 388
Joined: 10 Jul 2008, 02:26

Re: [SOLVED] SABnzbdplus / Shell question

Post by Binkem »

Hi,

I remember that I started using ConTEXT because of the problems editing these files in Notepad gives. I had to do some maintenance to the file after updating SABnzbd to the current version. This may be what caught me out. I do seem to remember having the thing working after I copied it to /etc/init.d. Well it must be age kicking in :?

Thanks anyway.

Martijn
Post Reply