4

I would like to specify a shell script (say one to send me an email) whenever a given user is authenticated, for example if prompted after sleep, fresh login or fast user switching.

PS: I found answers for running a script when the computer wakes from sleep and another for when a user logs into a fresh session, but that is not exactly what I'm looking for.

1

From https://apple.stackexchange.com/a/159510/76470 :

I found SleepWatcher, a free tool that allows to run a script when the screen goes to sleep or wakes up.

After installing it, you can link a shell script that is run on one of the available events (which include dim screen, wake up screen, computer sleep, wake up computer and some more). From the shell script, I can run a command, or call an AppleScript that I want to run on these events.

Since my screen goes to sleep when I lock my computer, this is exactly what I was looking for.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .