Announce: Beta version of SvrPowerControl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gharris999
    Senior Member
    • Apr 2005
    • 3548

    Announce: Beta version of SvrPowerControl

    This is beta release 20120427.163654 of the SrvrPowerCtrl plugin.

    It can be installed via the Extension Downloader. Just add:



    ..to the SBS Settings->Plugins list of 'Additional Repositories'. If you'd rather install manually, you may directly download the zipfile from here: http://srvrpowerctrl.googlecode.com/...rCtrl_beta.zip

    Changes since the last update:
    • On Linux systems, SrvrPowerCtrl can now optionally schedule system wake-ups for root crontab events.
    • Linux setup scripts now more flexible about LMS/SBS service account names (in anticipation of changes that should happen in LMS.)
    • Support for block files in /run/lock for Fedora 15/16, Ubuntu 11.10, etc.
    • Tested with LMS 7.8, svn 33939 and perl v5.12.4 on Ubuntu server 11.10.
    • Tested with LMS 7.1.1, svn 33718 and perl v5.14.2 on Fedora 16.


    Features include:
    • Idle monitoring now includes network i/o, and on linux and OSX computers, disk and CPU load monitoring as well.
    • Automatic 'push players on shutdown' feature can now push players to alternate servers in addition to mysqueezebox.com. E.g., push your players onto a SBTouch running 'tinysc'!
    • Now allows an unlimited number of custom commands to be defined.
    • Full support for the SBTouch and SBRadio.
    • Shutdown/restart/suspend/hibernate your SqueezeBox Server computer via your SqueezeBox’s IR remote, a Squeezebox Controller, iPeng or via the SBS web interface.
    • Execute custom scripts via the same.
    • Optionally switch players to MySqueezebox.com when shutting down/suspending/etc. Automatically fetches your players back to your local server on wakeup.
    • Wait until sleep playing has concluded before shutdown/suspend/etc.
    • Monitor attached players and shutdown the server after an idle period.
    • Automatic server wake up for SqueezeBox alarms or scheduled library scans.


    This plugin has been tested with Squeezebox Server 7.6.2 and Logitech Media Server 7.8 running on Ubuntu 11.10 and Fedora 16 and with Squeezebox Server 7.6.0 on OSX 10.6.6 and Windows 7. It ought to work (perhaps with some fiddling) on other linux distros as well. Setup scripts for OSX, and Debian and Redhat derived distros are included in the download. See the plugin's settings page for a link to detailed setup instructions.

    Downloads:
    SrvrPowerCtrl can be installed using Squeezebox Server's Plugin Downloader. Copy this link: http://srvrpowerctrl.googlecode.com/svn/beta.xml and paste it into the list of 'Additional Repositories' on the SBS Settings->Plugins page.

    Other associated utilities are all available at the project page: http://code.google.com/p/srvrpowerctrl/downloads/list

    Requirements:
    • For windows based servers, the plugin requires the SCPowerTool free utility available from the project download page: http://srvrpowerctrl.googlecode.com/...ool_latest.zip
    • For OSX based servers, the plugin requires the 'sudo', 'shutdown' and 'pmset' commands.
    • For linux based servers, the plugin requires the 'sudo' and 'shutdown' commands and the ‘pm-utils’ package to support suspending and hibernation.


    I've slacked off on active development of these plugins. Anyone is free to fork these projects with my blessing. (Not that you need my blessing, all the code is GPL.) See: http://code.google.com/p/srvrpowerctrl/source/checkout for instructions for downloading the code via svn.

    I'll continue to make the plugin available for a while yet via the beta repository. Please be forewarned that NO SUPPORT WHATSOEVER will be supplied to users of these plugins. Though this is the first post in a very, very long thread, I'll no longer be monitoring this. Sorry.

    Thanks,

    Gordon Harris
    Last edited by gharris999; 2012-04-27, 21:39.
  • Nonreality
    Senior Member
    • Feb 2008
    • 2037

    #2
    After reading the readme file I guess I misunderstood the purpose of the program. This shuts down the entire system not just squeezecenter on the server machine, correct? Is there something that enables a person to shut down squeezecenter and restart it thru the squeezebox remote? I use my laptop to add things to squeezecenter which is on a desktop about 14 ft away. Be nice to do a reboot of just squeezecenter and save all that precious energy. Hey I just turned 51, got to save what I can you know.
    If the rule you followed brought you to this, of what use is the rule.

    HTTP://www.last.fm/user/nonreality

    Comment

    • Phil Meyer
      Senior Member
      • Apr 2005
      • 5610

      #3
      Announce: Beta version of SvrPowerControl

      >Windows: does it work at all? I haven't had a chance to do much
      >testing.
      >

      Haven't managed to get it to work so far:

      [09:01:16.0686] Slim::Utils::Misc::msg (1329) Warning: [09:01:16.0681] Can't spawn "psshutdown.exe": No error at P:/Music/SlimServer/trunk/server/Plugins/SrvrPowerCtrl/Plugin.pm line 396.

      psshutdown.exe is in path within the system PATH env. I've been running psshutdown.exe via a .bat file called from the Execute plugin. I can run it direct from a cmd window.

      If you don't already, you may want to use the -accepteula option.

      I run SqueezeCenter from the source code as a service. Maybe the service doesn't pick up the PATH env?

      Comment

      • gharris999
        Senior Member
        • Apr 2005
        • 3548

        #4
        Phil: I see from the log entry that you have the plugin installed to the correct location for your setup. I don't mention using the plugin when running from the svn code in the readme. For other folks running from the svn code, remember that user plugins still need to be installed to ...\server\Plugins. I imagine that most folks tech-savvy enough to run from svn will know this.

        Are you comfortable with editing the plugin code? If so, try adding full paths to psshutdown.exe in the system calls in doSystemShutdwonWin. See if that makes a difference. I don't know if the perl system call is "path" aware or not. I had assumed that it was.

        And thanks for -accepteula.
        Last edited by gharris999; 2008-06-05, 16:07.

        Comment

        • gharris999
          Senior Member
          • Apr 2005
          • 3548

          #5
          Originally posted by Nonreality
          After reading the readme file I guess I misunderstood the purpose of the program. This shuts down the entire system not just squeezecenter on the server machine, correct? Is there something that enables a person to shut down squeezecenter and restart it thru the squeezebox remote? I use my laptop to add things to squeezecenter which is on a desktop about 14 ft away. Be nice to do a reboot of just squeezecenter and save all that precious energy. Hey I just turned 51, got to save what I can you know.
          I think that there is, in fact, a way to do this. I had worked out a method a couple of years ago involving the execute script plugin and adding a one-time event to the windows task scheduler. It was a horrible kludge, but it worked.

          Comment

          • gharris999
            Senior Member
            • Apr 2005
            • 3548

            #6
            I've done some more work on this plugin. It should be working with both linux and Windows XP now. Also, the "Shutdown/Hibernate to SqueezeNetwork" functions are working with all player types, including SBRs.

            Please see the updated attached zip in the first post in this thread: http://forums.slimdevices.com/showpo...28&postcount=1

            Comment

            • raglencross
              Senior Member
              • Aug 2006
              • 260

              #7
              So far, I have tried the "hibernate & switch to SN" option and it works fine in Windows XP. The "Readme" file states, "This plugin allows you to shutdown or restart your SqueezeCenter server, etc." I don't see how I can restart the hibernating server using your plugin because the only option available is the usual "Switch to SC" followed by "Waking up SC". This is a WOL action which I have never been able to get to work on my computer. Even if it is not possible to restart with the remote, your plugin saves one trip upstairs! Thanks.

              Comment

              • gharris999
                Senior Member
                • Apr 2005
                • 3548

                #8
                By "restart" I mean reboot a running server. I didn't think a "Reboot to SqueezeNetwork" option made much sense, so I didn't include it.

                Re not getting WOL to work on your computer:

                Have you set your BIOS to wake up on pci events? There ought to be an option to select this in your BIOS setup under the power management section.

                Have you set the WOL properties of the network adapter using the windows device manager? In the properties for your network adapter, select the "Power Management" tab and make sure the following entries are checked:

                [X] Allow this device to bring the computer out of standby.
                [X] Only allow management stations to bring the computer out of standby.

                If your machine/nic supports WOL, then it ought to work like this:

                Do a "Shutdown to Squeeze Network" and let the player switch to SN and let the server turn itself off. Play some content from SN. Then, using the remote, navigate to "Connect to SqueezeCenter". The player will sign off from SN and try to connect to your (turned off) server. When it gives up after a few seconds, press the power button on the remote. That should send a WOL packet and wake up your server. At least that's how it works for me with my server & Transporter & SB3.
                Last edited by gharris999; 2008-06-19, 03:46.

                Comment

                • raglencross
                  Senior Member
                  • Aug 2006
                  • 260

                  #9
                  Yeah, it occurred to me after submitting my reply that "restart" probably meant "reboot".
                  Thanks for the tips on the WOL matter. The key feature I seem to be missing is an option in my bios setup to handle a pci event. It looks to me like HP never implemented this despite the "magic packet" capability of the NIC per the manufacturer specifications for the device. Judging from the many posts in this forum on this issue, it appears that this is a common omission.

                  Comment

                  • gharris999
                    Senior Member
                    • Apr 2005
                    • 3548

                    #10
                    Originally posted by raglencross
                    The key feature I seem to be missing is an option in my bios setup to handle a pci event. It looks to me like HP never implemented this[...]
                    I'm surprised. How old is your system? I thought almost all BIOSs on PCs produced since 2002 or so supported this. I'd encourage you to keep experimenting with different BIOS settings. Is your NIC a separate pci card or is it a "built onto the motherboard" type?

                    Before the "pci event" method became the common means of supporting WOL, some manufacturers included a two wire connector on the motherboard that would get connected to a similar connector on the NIC. Perhaps your board has this feature. If it does, you might be able to find an older 3Com 100Tx card with this sort of connector cheaply on ebay.

                    I feel your pain. Life's just no damn good without WOL.

                    Comment

                    • raglencross
                      Senior Member
                      • Aug 2006
                      • 260

                      #11
                      My PC is only a few years old with the NIC being a chip or 2 on the motherboard, so shouldn't require the cable option. According to the manufacturer's on-line manual, implementing the "magic packet" WOL is a matter of setting a bit in a register. I guess I will have to look into that. In the mean time, I have a work around whereby I have set the bios to wake up the PC on application of power. The PC is plugged into a receptacle that can be turned on and off with a radio remote. Not elegant, but, along with your plug-in, saves me the trips upstairs to the PC when I want to use SC. I'm embarrassed to say how many times I have opted to use SN rather than climb the stairs;

                      Comment

                      • pichonCalavera
                        Senior Member
                        • Sep 2007
                        • 286

                        #12
                        Hey this looks very nice!

                        I have a Debian server running Etch, but run into some problems.

                        First I had to put the Plugin into /usr/share/squeezecenter/Plugins/ instead of /var/lib/squeezecenter/Plugins (I guess the Debian squeezecenter package manages differently than the rpm ).

                        I could not get the svrpowerctrlsetup file to execute, a error with the shell interpretation on my Debian system, so I proceeded manually.

                        I could not find the /etc/sudoers file on my system, and I guess this is the main problem... what would be equivalent file on Debian? , I already did the touch /etc/shutdown

                        I can see the menu on my SB3, but when I try to Shutdown the Server, after 15 seconds it just stops playing and shows the Now Playing text on the screen, it doesn't shut down. The same with the other 2 options. Changing to Squeezenetwork worked well, but of course it could not shut down the server.

                        Any help would be appreciated.
                        rip (eac) > convert (flac) > tag (musicbrainz/mp3tag) > normalize (replaygain/foobar2000) > albumart (www/firefox) > transport (winscp) > store (debian) > manage (squeezecenter) > control (ipodtouch/ipeng-app) > play (squeezebox) > preamplify (zpre2) > amplify (zampv3) > listen (axiomm2/sennheiser-hd595) > scrooble (last.fm) > enjoy (me :)

                        http://www.last.fm/user/pichonCalavera

                        Comment

                        • epoch1970
                          Senior Member
                          • Apr 2008
                          • 2280

                          #13
                          Are you missing sudo ?

                          Originally posted by pichonCalavera
                          Hey this looks very nice!
                          I have a Debian server running Etch, but run into some problems.
                          I could not find the /etc/sudoers file on my system, and I guess this is the main problem... what would be equivalent file on Debian? , I already did the touch /etc/shutdown
                          My etch box has /etc/sudoers but I wonder if it came with sudo by default.
                          Perhaps "apt-get -s -f install sudo" could help ?
                          (With "-s" apt switches to the "dry run" mode, spitting out all commands but actually not taking action. If the output looks good, then remove "-s" and run again the command)

                          I will take a look at the plugin. I have made the original script work on my box, here are a few hints:
                          - /etc/shutdown is of no relevance as far as I understand. I have not created it.
                          - You could add the squeezecenter user to the "sudo" users group to allow it to run the shutdown command : "usermod -a -G sudo squeezecenter". Normally this is supposed to slice bread but since my /etc/sudoers file had no definition for a "%sudo" group, it had no effect.
                          I ended up adding **using the visudo command** the following line to /etc/sudoers:
                          "squeezecenter ALL = NOPASSWD: /sbin/shutdown*"
                          Only type "visudo" (as root) then add this line (without quotes).
                          - Last I had an issue because of the 'lecture' option of sudo. First time you use it, sudo lectures you on how dangerous using sudo is. There is no logon shell defined for the squeezecenter system user, and I think this is a problem for the lecture thing. Sudo never works.
                          I did this to make it work:
                          + as root edit /etc/passwd and on the squeezecenter line, replace ":/bin/false" at the end of the line with ":/bin/sh".
                          + then still as root change to the squeezecenter user with "su squeezecenter" and the type something like "sudo ls"; get lectured.
                          + then reverse the edit in /etc/passwd and the plugin should work.
                          (there is certainly a better way specifying how to handle the lecture option but I am not aware of it.)

                          HTH

                          PS : WRT making WOL work on linux, I highly recommend reading this german wiki page which I think is a great resource, even translated by google.
                          Personally I had WOL enabled in BIOS, then enabled WOL on magic packets using ethtool in the /etc/network/interfaces file (with "post-up /usr/sbin/ethtool -s eth0 wol g" in the relevant section), but still no results.
                          As explained on the wiki page, I needed to coax ACPI in listening to the wake-up event with this (that I added to rc.local or another boot script) :
                          Code:
                          if (/bin/grep NMAC /proc/acpi/wakeup | /bin/grep disabled 2>&1 >> /dev/null) ; then
                              /bin/echo -n NMAC > /proc/acpi/wakeup
                          fi
                          (NMAC is the name of my integrated ethernet device. Yours is probably different, see the page.)
                          Last edited by epoch1970; 2008-06-22, 15:05.
                          2 SB 3 • 1 PCP 7 • Libratone Loop, Zipp, Zipp Mini • iPeng (iPhone + iPad) • LMS 8.1 (docker) with plugins: CD Player, WaveInput by bpa • Material Skin by Craig Drummond • IRBlaster by Gwendesign (Felix) • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • BBC Sounds by Stuart McLean • AirPlay Bridge by philippe_44 • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

                          Comment

                          • gharris999
                            Senior Member
                            • Apr 2005
                            • 3548

                            #14
                            epoch1970: would you be willing to add your debian-specific instructions to the readme file and post it back here? I'd like to add your info to the release version. I'm wondering if I should include distro-specific setup helper scripts.

                            Also: does your sudoers file contain the "Defaults requiretty" line? Did you comment that out? I never had to modify my passwd file to remove the nologin for the squeezecenter user.

                            I appreciate any help you guys can give me with other distros. Fedora is the only thing I've got running here. Thanks.

                            Comment

                            • epoch1970
                              Senior Member
                              • Apr 2008
                              • 2280

                              #15
                              Debian SrvPowerControl...

                              Gharris999,
                              I'll setup a clean debian etch (as a VirtualBox), install Squeezecenter and SrvPowerControl, and take precise notes of what's needed to get it running. I don't think it'll take too long.
                              Then I'll add the info the the Readme.

                              (I believe sudoers under debian comes empty or so. I completely overlooked the "requiretty" thing, that might be the -honorable- solution to the shell problem.)
                              2 SB 3 • 1 PCP 7 • Libratone Loop, Zipp, Zipp Mini • iPeng (iPhone + iPad) • LMS 8.1 (docker) with plugins: CD Player, WaveInput by bpa • Material Skin by Craig Drummond • IRBlaster by Gwendesign (Felix) • Smart Mix, Music Walk With Me, What Was That Tune? by Michael Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by Erland Isaksson • BBC Sounds by Stuart McLean • AirPlay Bridge by philippe_44 • Auto Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.

                              Comment

                              Working...