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).