I haven't tested this yet, and I'm not experienced with scripting. But I
think the following or something like it would work under Server Power
Control.

1. Create a program that does very little. The Applescript

delay 10

saved as a stay-open application would do (stay open is important). Give
it a name such as Waiter (perhaps better would be something more
complicated such as MyPersonalWaiter in case Waiter is part of the name
of some other process).

2. Now create a shell script whose active content is

if [ $(ps -ax | grep -c [: print:]*Waiter) = 1 ]
> then
>open -g pathtoWaiter.app
>caffeinate pathtoWaiter.app
fi

where pathtoWaiter.app os the full path to the application. (I had to
put in a space between : and p else it would have come out as a smiley)

The logic is as follows

The $( ) bit counts the number of running processes containing the word
Waiter. There will always be one (that is, if these were Terminal lines,
not sure if that also applies as a shell script) because the actual grep
message provides one such process, but more than one if Waiter is
running. So the condition holds only when Waiter is not running. If
Waiter is already running nothing happens

At that point Waiter gets opened in the background and caffeinate
prevents sleep while Waiter is running.

We should then be able to use this as the shell script for
ServerPowerControl to run.

One advantage of this script is that it can be used to prevent sleep
whenever we want, not just for LMS issues.

I'll experiment further, but better coders than me might like to try
themselves.


------------------------------------------------------------------------
danco's Profile: http://forums.slimdevices.com/member.php?userid=210
View this thread: http://forums.slimdevices.com/showthread.php?t=95980

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to