EDIT: this is part of my log file:
[12-03-13 04:56:53.0037] Plugins::SrvrPowerCtrl::Util::CLIExecCmd (810) no name requesting command: no id restartserver
[12-03-13 04:57:59.0074] Plugins::SrvrPowerCtrl::Util::CLIExecCmd (810) ein requesting command: 00:04:20:1e:69:ef restartserver
[12-03-13 05:06:35.2862] Plugins::SrvrPowerCtrl::Watchdog::OnWakeupWatchdog (647) Wakeup Call!!
[12-03-13 15:24:21.0028] Plugins::SrvrPowerCtrl::Util::SystemExecCmd (851) Squeezebox Boom: ein via SrvrPowerCtrl executing command: C:\Windows\system32\cmd.exe /C start /B scpowertool.exe --standby -q --log=C:\ProgramData\Squeezebox\Logs\srvrpowerctrl.l og
[12-03-13 15:25:42.3882] Plugins::SrvrPowerCtrl::Watchdog::OnWakeupWatchdog (647) Wakeup Call!!
[12-03-13 15:41:02.0038] Plugins::SrvrPowerCtrl::Watchdog::SleepEndWatchdog (600) SleepEndWatchdog Action: suspend
[12-03-13 15:41:37.0101] Plugins::SrvrPowerCtrl::Util::SystemExecCmd (851) Squeezebox Boom: ein via SrvrPowerCtrl executing command: C:\Windows\system32\cmd.exe /C start /B scpowertool.exe --standby -q --log=C:\ProgramData\Squeezebox\Logs\srvrpowerctrl.l og
[12-03-13 17:59:51.4068] Plugins::SrvrPowerCtrl::Watchdog::OnWakeupWatchdog (647) Wakeup Call!!
[12-03-13 18:35:38.4816] Plugins::SrvrPowerCtrl::AltServer::PushToAltServer (223) No client to push!
[12-03-13 18:50:57.3912] Plugins::SrvrPowerCtrl::AltServer::PushToAltServer (223) No client to push!
[12-03-20 20:15:22.1457] Plugins::SrvrPowerCtrl::AltServer::PushToAltServer (223) No client to push!
[12-03-21 18:00:12.7636] Plugins::SrvrPowerCtrl::AltServer::PushToAltServer (223) No client to push!
[12-03-23 17:50:54.6636] Plugins::SrvrPowerCtrl::AltServer::PushToAltServer (223) No client to push!
[12-04-10 21:33:50.0482] Plugins::SrvrPowerCtrl::AltServer::PushToAltServer (223) No client to push!
[12-04-11 01:45:21.1862] Plugins::SrvrPowerCtrl::Util::SystemExecCmd (851) SrvrPowerCtrl executing command: C:\Windows\system32\cmd.exe /C start /B starthidden.exe scpowertool.exe --wakeup=1334120100 -q --log=C:\ProgramData\Squeezebox\Logs\srvrpowerctrl.l og
Results 1,981 to 1,990 of 2059
-
2012-04-28, 14:29 #1981Junior Member
- Join Date
- Apr 2012
- Posts
- 4
-
2012-05-25, 01:38 #1982
Blondie: Your idea was a good one and I'm using it all the time on my own system now. I've extended your custom idle check script to check for samba file locks too. This is still a little experimental. I'll use this for a few days and see how it works.
spc-checkidle.sh:
Edit: updated the script to make the samba checking more comprehensive and not just check for exclusive locks. Now, just having a samba share open in a windows explorer client will trigger a block.Code:#!/bin/sh # SrvrPowerCtrl custom idle check script. # # This returns the number of user log-ins or the number # of active samba locks and can be used to prevent # SrvrPowerCtrl on-idle actions. # # Configure SrvrPowerCtrl's "Custom Idle check command" to # call this script. LOGGING=0 VERBOSE=0 LOGFILE= DATE=$(/bin/date '+%Y-%m-%d %H:%M:%S') SCRIPT=$(basename $0) CHECKSAMBA=$(which smbd | wc -l) USERCOUNT=0 SAMBALOCKS=0 #################################################################################### # Get the log file name.. # get_log_file(){ if [ $LOGGING -gt 0 ]; then SLIMLOGDIR=`pgrep -fl 'perl.*squeeze|perl.*slim|perl.*logitech' | sed -n -e 's#^.*--logdir \(.*\)/ .*$#\1#p'` # Punt if ([ -z "$SLIMLOGDIR" ] || [ ! -d "$SLIMLOGDIR" ]); then SLIMLOGDIR='/var/log/squeezeboxserver' fi LOGFILE="${SLIMLOGDIR}/srvrpowerctrl.log" else LOGFILE='/dev/null' fi } #################################################################################### # Check for active login sessions.. # check_logins(){ USERCOUNT=$(who -u | wc -l) } #################################################################################### # Check for active samba file locks.. # check_samba_locks(){ SAMBALOCKS=$(smbstatus -L | egrep '^[0-9]* .*$' | wc -l) } log_checks(){ echo "${DATE} ${SCRIPT}: Usercount: ${USERCOUNT}, Samba locks: ${SAMBALOCKS}" >> $LOGFILE } disp_checks(){ echo "${DATE} ${SCRIPT}: Usercount: ${USERCOUNT}, Samba locks: ${SAMBALOCKS}" } #################################################################################### # main() # # Process command line.. for ARG in $* do case $ARG in --help) echo "${SCRIPT} [--log] [--verbose]" exit 0 ;; --log) LOGGING=1 ;; --verbose) VERBOSE=1 ;; esac done check_logins if [ $CHECKSAMBA -gt 0 ]; then check_samba_locks fi if [ $LOGGING -gt 0 ]; then get_log_file log_checks fi if [ $VERBOSE -gt 0 ]; then disp_checks fi exit $(($USERCOUNT+$SAMBALOCKS))Last edited by gharris999; 2012-05-25 at 19:33.
-
2012-05-25, 05:22 #1983Senior Member
- Join Date
- Jul 2006
- Location
- UK
- Posts
- 231
-
2012-05-26, 21:35 #1984Senior Member
- Join Date
- Jan 2006
- Location
- South Coast, NSW, Australia
- Posts
- 636
Start of Day function ?
I have used Server Power Control for years to shut my Squeezebox server down, more recently using the excellent End of Day functions.
I also use a custom command to increase the data base cache size (cli//PRAGMA%20cache_size%20%3D%20250000) that appears to speed up various browsing functions. The only drawback with this command is that it is manual - I have to remember to execute it as my server wakes up automatically each morning.
Is there a way of executing a command when the server starts up, in other words a "Start of Day" function ?
At End of Day I shut down the server rather than hibernate as the server is also used as a TV recorder and the program guide is updated as part of the start up process.A camel is a racehorse designed by a committee.
-
2012-05-27, 16:57 #1985
Ola, John!
Re 'Start of Day' function:
If you give your custom command the label '.autoexec', it will get executed when SrvrPowerCtrl is initialized. Note: any custom command label that starts with a '.' gets hidden and doesn't show up on the SrvrPowerCtrl menu. Hidden commands are still available from the cli, of course.
Note, some time ago (I'm not sure if it started with lms 7.7.3 or 7.8) I had to redo all my SrvrPowerCtrl custom command cli strings, replacing the '%20's with spaces. I.e. I had to un-percent escape them. If your cli command doesn't work, you might try that.
-
2012-05-28, 02:24 #1986Senior Member
- Join Date
- May 2009
- Location
- Brentwood, UK
- Posts
- 364
1 x Touch - LMS 7.8.0
1 x Radio
1 x Boom
Lavry DA-10 DAC
HP PC as main Media Server
QNAP TS-509 3.6.1 running SSOTS v4.14
Starfish Pre-amp : Based on NAIM
Heavily modified NAIM NAP 250 Power-amp
Behringer DEQ2496
Linn Isobarik DMS
-
2012-05-28, 17:45 #1987Senior Member
- Join Date
- Jan 2006
- Location
- South Coast, NSW, Australia
- Posts
- 636
Gordon, thank you - .autoexec is the go.
Bob - good question ! Can we pursue it over here - http://forums.slimdevices.com/showth...se-more-memory ?Last edited by Wirrunna; 2012-05-29 at 01:19.
A camel is a racehorse designed by a committee.
-
2012-06-02, 07:49 #1988Junior Member
- Join Date
- Jun 2012
- Posts
- 1
Prevent from Suspend?
Hi,
Thankx for this great plugin!
I installed SrvrPowerCtrl (beta) at my SqueezeboxServer7.7.2 (on Debian6.0.4). Now I've two questions:
1: I would like to use the CPU-load option to prevent the server from going to suspend when working with the server. My CPU-load is around 0.1 at idle and between 0.2 and 0.8 in part load. How can I set the value to 0.15? Obviously only integers are allowed.
2: I use the server as multimedia and internet desktop as well. So I wrote a little script to prevent suspending when I work with epiphany or amarok. That is my code:
#!/bin/bash
declare -i progactive
progactive=0
progactive=$(pgrep epiphany || pgrep amarok)
if (($progactive>0))
then
exit 1
else
exit 0
fi
This works well except epiphany or amarok crashes. Pgrep still returns a PID. Anyone knows a better solution? I'm not a programmer anyway ;-)
Thanks a lot.
Snoopy81
-
2012-06-10, 05:40 #1989
Last edited by gharris999; 2012-06-10 at 05:44.
-
2012-06-21, 11:37 #1990
How are you computing your CPU load? On linux systems, SrvrPowerCtrl is parsing /proc/loadavg and using the 1st decimal number for the 1 minute average. See: http://www.lindevdoc.org/wiki//proc/loadavg
Here is the code I'm using:
cpuload.pl:
On my system, with a reasonably CPU intensive task running (rsync), I'm getting a figure of:Code:#!/usr/bin/perl -w sub CPUStat { my $szRegEx; my $cpustats; my $cpuload = 0.00; my $procloadavg = '/proc/loadavg'; if (! -e $procloadavg || !open(PLA, "<$procloadavg")) { return 0; } $cpustats = <PLA>; close(PLA); #1.42 1.00 0.84 2/328 2842 $szRegEx = '^\s*(\d+\.\d+).*$'; if ( $cpustats =~ /$szRegEx/ ) { $cpuload = $1; } return $cpuload; } my $cpuaverage = CPUStat(); print("CPU load: $cpuaverage (last 1 min average)\n");
# CPU load: 2.34 (last 1 min average)
So for me, a CPU load threshold setting of 2 should be about right.
What do you get with the above script when you're running your "part load"?
If you're still seeing results below 1, and before I change the plugin to allow decimal numbers for that setting, would you be willing to try editing the:
/var/lib/squeezeboxserver/prefs/plugin/srvrpowerctrl.prefs
..file? Try adding your decimal number to the:
nIdleCPULoadThreshold:
..entry and see if that does the trick for you.
PS: if you set SrvrPowerCtrl's logging setting to debug, you'll see the CPU stats show up in the server log. You may need to turn off all the other SrvrPowerCtrl idle detections in order to see it. SrvrPowerCtrl goes through it's list of idle states to check and stops checking at the first 'not idle' condition it finds. I.e., music playing trumps everything else and will prevent the other checks from occurring.Last edited by gharris999; 2012-06-21 at 11:40.


Reply With Quote
