On Feb 14, 2007, at 14:18, Nick McSpadden wrote:
This is really more of a UNIX question than an ARD question, so sorry
if this is off topic.
I want to set up a repeated job on the macs that checks their load
average and then performs certain tasks based on that. It's easy
enough to do load average checking with the UNIX command "uptime."
I know I can get the load average amount with the UNIX command:
uptime | cut -c 48-49
(so if the load average is 0.18, I'll get 18 as the number).
I then want to test this against a threshold amount, such as 40 (i.e.
if load average goes above 0.4):
In a UNIX shell script, i can set this to:
#!/bin/bash
let LAVG=`uptime | cut -c 48-49`
let THRESHOLD=40
if ( $LAVG > $THRESHOLD)
then
<do stuff....>
else
<do something else....>
fi
I get a different location for uptime, so I modified the LAVG line.
BTW, if your load average goes up over 0.99, you'd not see the whole
number.
#!/bin/bash
LAVG=`uptime | cut -c 48-49`
LAVG=`uptime`
LAVG=`expr "$LAVG" : '.*\: [^\.]*\.\(..\)'`
THRESHOLD=40
if [ "$LAVG" -gt $THRESHOLD ]
then
# <do great things>
echo do
else
# <do lesser things>
echo do not
fi
John
--------------------------------------------------------------------------
"They that can give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety."
----
Benjamin Franklin
--------------- "Dotage," Beneteau 373 -----------------
John P. Mundt Network Manager
Hawthorn District 73 email@hidden
Vernon Hills, IL 60061 847-990-4591
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Remote-desktop mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/remote-desktop/email@hidden
This email sent to email@hidden