![]() |
FU FU : Running OS X on AppleTV - method to query system profiler - Printable Version +- MacResource (https://forums.macresource.com) +-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1) +--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3) +--- Thread: FU FU : Running OS X on AppleTV - method to query system profiler (/showthread.php?tid=54565) |
FU FU : Running OS X on AppleTV - method to query system profiler - mattkime - 05-09-2008 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. Re: FU FU : Running OS X on AppleTV - method to query system profiler - smanoli - 05-09-2008 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=20051025103428232 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. |