Create a logoff script/task for Mac OS X

2

2

Related to my other question on Windows, how would one go about creating a logoff script for Mac OS X?

warren

Posted 2009-11-04T09:11:19.093

Reputation: 8 599

Answers

3

What do you mean by "logoff script"? If you mean "how to logoff current session from the terminal", then you can do this from any shell script or terminal:

osascript -e 'tell application "System Events" to log out'

If by "logoff script" you mean "a script that is executed when one logs off", then I invite you to read this nice post on that topic (with example scripts): http://www.bombich.com/mactips/scripts.html, or see the official documentation here: http://support.apple.com/kb/HT2420?viewlocale=en_US

Another very nice example: http://hints.macworld.com/article.php?story=2006081701162739

Zoran

Posted 2009-11-04T09:11:19.093

Reputation: 999

the second, yes - a script that runs at logoff, like the old "Shutdown Items" in the System folder on old version of Mac OS :) – warren – 2009-11-04T09:45:55.823

1

Here's another very nice and simple example on login/out hooks: http://www.macosxhints.com/article.php?story=2006081701162739

– Zoran – 2009-11-04T09:56:12.713

would you mind adding that link (http://www.macosxhints.com/article.php?story=2006081701162739) to your answer, so I can accept it?

– warren – 2009-11-09T16:21:01.977

Sure, added the link to the response. – Zoran – 2009-11-10T06:22:13.047