I would like to run something like "sleep 3600; logout", but the logout bash command only closes the current terminal. How do I close the full Mac OS X session?
The following Applescript will logout the current user:
You can wrap this up in a bash alias using the
It is the same as clicking " > Log out [username]...", and will logout after a 2 minute wait
This is easily combined with the
..or could be combined into a single alias:
There is no "nice" way to log the current user out from Terminal in OS X. The 'messy' way of doing it is to kill that user's
Doing this is a two-step process.
Use sudo kill -9 to force kill the process which I had to do to get this to work.
So for example, when if the output to the first command is:
Then I would run
This can be combined into an bash alias: