Andy.Couture

Detecting OS using LUA

Discussion created by Andy.Couture on May 2, 2013
Latest reply on Mar 19, 2015 by kkrenbrink

I am trying to write a script in AO to detect the OS flavor (Windows or UNIX) and then append a message depending on OS. but I'm having issues. When I use the following script, UNIX is being appended to the message of a windows box. But it is appended and appended until the message block is filled. Here is the script and message:

 

local a = alarm.get()
local system = ""
local update = {}
local message = ""
update.nimid = a.nimid


if System == "WINDOWS" then
update.message = a.message.." Windows"
else
update.message = a.message.." UNIX"
end
alarm.set(update)

 

 

Average (1 samples) total cpu is now 7.71%, which is above the warning threshold (1%) UNIX UNIX UNIX UNIX UNIX UNIX UNIX UNIX UNIX

 

 

Outcomes