Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FU FU : Running OS X on AppleTV - method to query system profiler
#1
In follow up to: http://forums.macresource.com/read/1/490091/490377

System Profiler has a command line equivalent! system_profiler.

man system_profiler will give you all the gory details but here is the summary -

get list of hardware that system profiler can report -
system_profiler -listDataTypes

get just USB devices -
system_profiler SPUSBDataType

search for particular device (in this case, "Canon") -
system_profiler SPUSBDataType | grep Canon

AppleScript that reports whether or the not specified device is connected -

try
do shell script "system_profiler SPUSBDataType | grep Canon"
display dialog "you have it!"
on error
display dialog "you don't!"
end try

---

I'd still like to figure out how to get launchd to run a script as root. its my last task.
Reply
#2
Does lauchd allow you to us the sudo command. This command allows you to run something as root using your (admin account) password. By editing the sudoers file you can allow certain programs to even be run without a password.

http://www.afp548.com/article.php?story=...5103428232 has some info on editing sudoers.

I've edited my sudoers file to add my non admin account and allow it to run a script without my password. All other uses of sudo still require my password though.

Don't know if this helps with your situation, if it sounds like it might, I can dig up some more info for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)