On Finish: Shutdown PC

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
kammo
Newbie
Newbie
Posts: 4
Joined: December 17th, 2013, 11:42 am

On Finish: Shutdown PC

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: On Finish: Shutdown PC

Post 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.
User avatar
jcfp
Release Testers
Release Testers
Posts: 1022
Joined: February 7th, 2008, 12:45 pm

Re: On Finish: Shutdown PC

Post 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)?
kammo
Newbie
Newbie
Posts: 4
Joined: December 17th, 2013, 11:42 am

Re: On Finish: Shutdown PC

Post 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]...
User avatar
jcfp
Release Testers
Release Testers
Posts: 1022
Joined: February 7th, 2008, 12:45 pm

Re: On Finish: Shutdown PC

Post 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.
kammo
Newbie
Newbie
Posts: 4
Joined: December 17th, 2013, 11:42 am

Re: On Finish: Shutdown PC

Post 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 ;)
User avatar
jcfp
Release Testers
Release Testers
Posts: 1022
Joined: February 7th, 2008, 12:45 pm

Re: On Finish: Shutdown PC

Post 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!
kammo
Newbie
Newbie
Posts: 4
Joined: December 17th, 2013, 11:42 am

Re: On Finish: Shutdown PC

Post 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...
Post Reply