I'm exploring building an internal site that displays what computers in the lab are currently being used. My initial idea involved a webapp that took in info from each computer every 5-10 minutes and then displayed that information. What I'm wondering is if there's a good way of getting the status of a machine (if it's logged on, and what program is currently on top)? Is this something that can be done at the shell level? (for instance, some sort of chron job, or script that runs while somebody is logged on).
Things might have changed since I last checked this (10.6.5ish), but a user running Dock was usually a good indicator he/she is logged in:
And you can get a sort of list of running apps by running:
This is a little bit weak because some apps run outside of the /Applications folder..