Guarantee/force remote shutdown
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).
Solution 1:
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.
Solution 2:
Power Manager
Power Manager can be used to remotely shut down a Mac. You can do this to a schedule or on-demand through a secure remote connection.
Applications that traditionally block log out are not a problem for Power Manager. Power Manager works through a series of steps to safely shut down a Mac; these steps are:
- Running applications are sent a friendly quit request.
- Running applications are given time to quit.
- If an application has not quit in time, the application is force quit.
- With all the applications quit, the user is logged out.
- Once all the users are logged out, Power Manager then asks macOS to shut down.
I am an engineer working on Power Manager, so feel free to ask technical questions or get in touch via the company's support e-mail address.