krypted.com

Tiny Deathstars of Foulness

Reporting on application usage is an interesting topic on the Mac. This is done automatically with a number of device management solutions. But there are things built into the OS that can help as well.

mdls "/Applications/Xcode.app" -name kMDItemLastUsedDate | awk '{print $3}'

Now, if you happen to also need the time, simply add ,$4 to the end of your awk print so you can see the next position, which is the time. Additionally, a simple one-liner to grab the foreground app via AppleScript is:

osascript -e 'tell application "System Events"' -e 'set frontApp to name of first application process whose frontmost is true' -e 'end tell'

That’s pretty much all I had to say about that.

September 27th, 2018

Posted In: Mac OS X, Mac Security

Tags: , , ,

The options for Open Directory continue to get more refined, aligning with opendirectoryd. The odutil command is becoming more and more useful with each version of OS X. Let’s inspect the directory service cache, using odutil with the show verb and the cache option: odutil show cache You can also view statistics for opendirectoryd using that show verb but with the statistics option: odutil show statistics And to see everything, use odutil with the show verb and the all option to get plenty of data to grep through: odutil show all The final show option we’ll look at is configuration. Here, you will also need to feed a directory nodename into the command: odutil show configuration /Search Now, /Search is a node but there are a lot. You can use show with nodes to see a listing of all the nodes: odutil show nodes You can then see which pids have references to opendirectoryd as well as the nodenames, reference IDs, and session IDs. All of this can be very helpful when troubleshooting Open Directory issues. One thing I find I do pretty frequently is resetting statistics then repeating a process that is causing a problem so I can view only the updated statistics. To do so: odutil reset statistics You can also disable statistics (I’ve seen them create performance concerns: odutil set statistics off Or to turn them back on: odutil set statistics on Once upon a time you could killall DirectoryService with a -usr level to set various logging levels. With opendirectoryd, we can still do that, but it’s less cludgy with odutil. Here, we’ll set the logging level as detailed as we can get: odutil set log debug Other levels, in ascending order of verbosity, include alert, critical, error, warning, notice, and info.

July 10th, 2015

Posted In: Active Directory, Mac OS X, Mac OS X Server, Mac Security, Mass Deployment

Tags: , , , , , , ,

At the bottom of the sidebar, you will now find badges for my pages on the main social networks. I also added Flickr & Facebook into a new Pictures page (and added pictures to the actual Flickr account since I mostly used Facebook for that)… Also changed the title and post-info/comments sections to the dark red color scheme, since I didn’t really think they looked right as black any longer. Finally, made the navbar a little slimmer. Hope ya’ll like the changes.

December 5th, 2009

Posted In: sites, Social Networking

Tags: , ,