Guarantee/force remote shutdown

remote desktopshutdown

Situation: a mac running 10.14, accessed from a Windows laptop via TeamViewer remote desktop software.

Problem: sometimes apps will prevent shutdown. "Xcode interrupted shutdown" or similar. Once every 1-3 weeks.

Because the TeamViewer app on the mac quits successfully — terminating the network connection before the "$app interrupted shutdown" message is shown — I never see this message myself and only know about it because coworkers with physical access report it to me when I ask for their help.

When the mac fails to shut down, the automatic boot-up the next morning also never runs, therefore the TeamViewer app on the mac never re-opens, therefore I can't connect to it remotely the next day.

Question: Is there some way to force the mac to shutdown, no matter what state it is in, even when apps interrupt the process?

(Software solutions only — while a timer switch that periodically cuts power would work, I don't want to risk physical damage from regular power interruptions).

Best Answer

Have you tried to execute shutdown from Terminal:

sudo shutdown -h 2011032000 "Shutting down at 8:00pm tonight"

You can specify the precise time, using the yymmddhhmm format, and using a 24-hour clock for the time.

At least it doesn't ask me to quit or save any running program. It will simply quit anything running in.

You can make automator script to execute too if this helps for your requirement.