Page 1 of 1

On Finish: Shutdown PC

Posted: December 17th, 2013, 11:55 am
by kammo
Hi folks,

I'm running Lubuntu 13:10 and SABnzbd 0.7.16 with the Plush - gold web interface.

If I select...
On Finish: Shutdown PC
...when the queue finishes SABnzbd shuts down OK, but the PC stays on.

Here's some log output:
http://pastebin.ubuntu.com/6589746/

Any ideas?

Re: On Finish: Shutdown PC

Posted: December 17th, 2013, 2:06 pm
by shypike
SABnzbd isn't compatible with your OS version.
Linux power management is limited, in a later release we'll expand it.
An alternative is to write your own little end-of-queue script that shuts down the system.

Re: On Finish: Shutdown PC

Posted: December 17th, 2013, 2:11 pm
by jcfp
I can get sab to shutdown the system fine in most cases on xubuntu 13.10, out of the box. How did you start sab? If you started it as a system service, does it make any difference if you restart the service after logging in to your lubuntu desktop (sudo service sabnzbdplus restart)?

Re: On Finish: Shutdown PC

Posted: December 18th, 2013, 6:03 am
by kammo
I am starting it as a service and it always starts OK. Last night I tried restarting the service as you suggested and it did shutdown OK after that. Today I've tried it several more times, with and without restarting the service, but it's only shutdown the once.

That time I noticed when I ran restart I got this and I'm pretty sure that's what I saw last night when it worked too:

Code: Select all

leon@htpc:~$ sudo service sabnzbdplus restart
[sudo] password for leon:
 * SABnzbd+ binary newsgrabber: not running
 * Starting SABnzbd+ binary newsgrabber   [fail]
dunno if that's significant, but every other time I run restart I see [OK] rather than [fail]...

Re: On Finish: Shutdown PC

Posted: December 19th, 2013, 3:00 pm
by jcfp
kammo wrote:Last night I tried restarting the service as you suggested and it did shutdown OK after that. Today I've tried it several more times, with and without restarting the service, but it's only shutdown the once.
No clue unfortunately, this dbus stuff isn't my forte. Every time I try this in a xubuntu saucy/13.10 vm it just ... works.
kammo wrote:That time I noticed when I ran restart I got this and I'm pretty sure that's what I saw last night when it worked too:

Code: Select all

leon@htpc:~$ sudo service sabnzbdplus restart
[sudo] password for leon:
 * SABnzbd+ binary newsgrabber: not running
 * Starting SABnzbd+ binary newsgrabber   [fail]
dunno if that's significant, but every other time I run restart I see [OK] rather than [fail]...
Probably not, just a manually started instance in the way. In the heat of testing... :D The init script in versions before 0.7.17 is very picky about not acting on processes it didn't start.

Re: On Finish: Shutdown PC

Posted: December 20th, 2013, 6:54 am
by kammo
Thanks for taking the time to help. It's more of a nicety than necessity - so no big deal.

Perhaps if I can find some time I'll give shypike's idea a shot and write an end of queue script - I'm a bit of a Linux noob and don't really know bash scripting - so not sure how far I'll get with that ;)

Re: On Finish: Shutdown PC

Posted: December 20th, 2013, 9:30 am
by jcfp
The script could be really simple:

Code: Select all

#!/bin/sh
sudo shutdown -h now
Shutting down the system this way requires root though, so you will have to give the user running sab the right execute the shutdown command as root without requiring interaction (i.e., without feeding sudo a password). Add a file under /etc/sudoers.d/ with ownership root:root, permissions 0440 (-r--r-----), that contains just this:

Code: Select all

username ALL = NOPASSWD: /sbin/shutdown
(replace 'username' with the real thing, obviously)

Please note that /etc/sudoers.d/ is a directory; by default there's only a README file in there. Be careful to never touch the /etc/sudoers file, if you screw that one up sudo stops working!

Re: On Finish: Shutdown PC

Posted: December 22nd, 2013, 10:01 am
by kammo
Just to say I've implemented the scripts according to jcfp's post above and all is well and sab is now shuting down consistantly.

@jcfp - Thanks again for your help...