Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

eyoungren

macrumors Penryn
Original poster
Aug 31, 2011
29,721
28,516
Does anyone know a way to schedule an automatic logout on Sonoma? Either through the OS or another app?

I am aware that I can schedule a logout for inactivity via Settings, but that's not what I'm looking for. I'm looking for something that will logout on a specific day and time.

I know Onyx can schedule shutdowns and startups and sleep, but I see no option there for a logout. May have missed the setting though.

I have a slowly growing over time WindowServer process that if I do not periodically logout will eventually cause problems. I've solved a major part of the issue, but I'd still rather have a set logout schedule than having to deal with the Mac being wonky when I want to use it. Logging out resets the process.

In case it matters, specs: 2009 MacPro 5,1 (4,1 firmware upgraded), 56GB ram, Sonoma 14.5
 
Paid apps
iShutdown https://apps.apple.com/app/ishutdown/id511622885
Shuttie https://apps.apple.com/app/shuttie/id415184888
Free
Scheduling Timed Jobs https://developer.apple.com/library...l/BPSystemStartup/Chapters/ScheduledJobs.html
launchctl reboot logout
"With the logout argument given, launchd will tear down the caller's GUI login session in a manner similar to a logout initiated from the Apple menu. The key difference is that a logout initiated through this subcommand will be much faster since it will not give apps a chance to display"
A launchd Tutorial https://www.launchd.info/
Crontab creator https://apps.apple.com/app/crontab-creator/id1438725196

Another approach Hypnotize, replace tell application "System Events" shut down with tell application "System Events" log out https://forums.macrumors.com/threads/macbook-air-sonoma-sleep-timer.2414412/
 
  • Like
Reactions: eyoungren
Paid apps
iShutdown https://apps.apple.com/app/ishutdown/id511622885
Shuttie https://apps.apple.com/app/shuttie/id415184888
Free
Scheduling Timed Jobs https://developer.apple.com/library...l/BPSystemStartup/Chapters/ScheduledJobs.html
launchctl reboot logout
"With the logout argument given, launchd will tear down the caller's GUI login session in a manner similar to a logout initiated from the Apple menu. The key difference is that a logout initiated through this subcommand will be much faster since it will not give apps a chance to display"
A launchd Tutorial https://www.launchd.info/
Crontab creator https://apps.apple.com/app/crontab-creator/id1438725196

Another approach Hypnotize, replace tell application "System Events" shut down with tell application "System Events" log out https://forums.macrumors.com/threads/macbook-air-sonoma-sleep-timer.2414412/
Thank you very much, will look through these a bit later.
 
Paid apps
iShutdown https://apps.apple.com/app/ishutdown/id511622885
Shuttie https://apps.apple.com/app/shuttie/id415184888
Free
Scheduling Timed Jobs https://developer.apple.com/library...l/BPSystemStartup/Chapters/ScheduledJobs.html
launchctl reboot logout
"With the logout argument given, launchd will tear down the caller's GUI login session in a manner similar to a logout initiated from the Apple menu. The key difference is that a logout initiated through this subcommand will be much faster since it will not give apps a chance to display"
A launchd Tutorial https://www.launchd.info/
Crontab creator https://apps.apple.com/app/crontab-creator/id1438725196

Another approach Hypnotize, replace tell application "System Events" shut down with tell application "System Events" log out https://forums.macrumors.com/threads/macbook-air-sonoma-sleep-timer.2414412/
So, this is the approach I came up with. I don't want to fool around with stuff really (although I can), so I updated Lingon X. I'd forgotten about this app, but it allows you to schedule cron jobs using a GUI. I simply added a job for me (it allows you to choose, all, system, individual users, etc), copy/pasted the command you mentioned above, scheduled the job and let Lingon X create all the details.

Then I tested it and it worked just fine. Better than fine I think because all the apps that were open, my connected servers, etc came right back when I tapped the mouse (it was sitting on a black screen with nothing but code). The offending process had dropped from 1.3GB of ram use to 150mb.

So, I know it's working. The first real test will be 6am tomorrow morning (Saturday). Thank you very much.
 
Last edited:
  • Like
Reactions: bogdanw
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.