I have two utility applications. I would like to detect which of these was run most recently. My initial idea was to use stat
to check the access timestamp on the application files and then compare:
mac:~ user$ stat -qf '%a %N' '/Applications/my-app1.app' '/Applications/my-app2.app' | sort -nr | head -n1 | cut -d ' ' -f2-
/Applications/my-app2.app
mac:~ user$
However this is insufficient, because there are other reasons these apps are being accessed - I assume by the backup system I am using.
Are there any system logs that I can examine to determine which of these apps was started most recently?