Macro to warn (or run) on log off


We have two drone machines that run all the time recording concerts. I've written a script that runs at startup to warn of any crash (and turned on restart and automatic log in), but occasionally for some odd reason the computers just log out of the account. We don't get warnings, because there wasn't a crash. I basically need to know when any of these recording applications stop, either by sending a message from that machine, or have a macro on another machine that periodically checks to see who is logged on, and if these apps are running.

Any suggestions?

Hello! I don’t think there is any way to solve this with Keyboard Maestro because if the rest of the system and apps are being logged out, I expect that Keyboard Maestro and it’s engine would too.

However, one possible solution is Power Manager which specifically has a feature designed to run scripts on logout.

Presumably that script could include some kind of remote notification. I use Pushover: Simple Notifications for Android, iOS, and Desktop and I have a shell script to go with it. That might be useful as a potential starting point.

Kind of related: I would caution against trying to use a LogoutHook. That feature has been deprecated in macOS for a long time, but it has worked until fairly recently, so you might see references to it on the web.

and again TJ to the rescue. Thanks for the script!

1 Like