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

Buadhai

macrumors 65816
Original poster
Jan 15, 2018
1,169
448
Korat, Thailand
I have a 2010 MBA running High Sierra (I think) at my condo which I normally visit once a month.

I have the machine set to restart daily just after midnight. Normally, this works fine. Except sometimes some process gets stuck and prevents the MBA from restarting. Meanwhile, all the other applications have shut down and the MBA just sits there with an error message until someone manually intervenes.

Normally I'm able to log on to the machine remotely via RealVNC or a reverse SSH tunnel. (The machine is behind a double NAT.) But, when the restart hangs, neither VNC nor the SSH tunnel are available.

Is there any reliable way to get the machine to restart gracefully without being hung by an errant process?
 
Naturally, if the reboot fails, you won't be able to remotely access it. Knowing this, I recommend that you reconsider having the machine reboot every night. I cannot think of any good reason to do this. Most machines that operate as servers are left on 24/7.
 
I have a 2010 MBA running High Sierra (I think) at my condo which I normally visit once a month.

I have the machine set to restart daily just after midnight. Normally, this works fine. Except sometimes some process gets stuck and prevents the MBA from restarting. Meanwhile, all the other applications have shut down and the MBA just sits there with an error message until someone manually intervenes.

Normally I'm able to log on to the machine remotely via RealVNC or a reverse SSH tunnel. (The machine is behind a double NAT.) But, when the restart hangs, neither VNC nor the SSH tunnel are available.

Is there any reliable way to get the machine to restart gracefully without being hung by an errant process?
I have several Macs at work running as servers which go for weeks without needing a restart. Is there a particular reason you're restarting this one daily?
You'll need to determine what it is that's causing this computer to hang up. It may be as simple as someone being connected remotely to it, causing the computer to sit there with a message that someone is connected remotely and asking for a confirmation to restart.
 
It's been so long that I can't remember what issue I was resolving with the nightly reboot. Next time I'm there I'll turn that off and see what happens.

Generally, the failure to reboot is caused by me logging in remotely and forgetting to quit whatever I was working on. Maybe I start a terminal session and forget to log off. Maybe I run BBEdit and forget to save a document.

But this time I'm just not sure because I hadn't logged in remotely for several weeks. I won't know what process failed to quit until I get there. Given the Covid-19 lockdown here in Thailand that might be several weeks or more.
 
If you need it to reboot regardless of any apps running, you could use a cron job with "reboot -q" which reboots without cleanly shutting everything down. A reboot without the "-q" might also work where the default "shutdown -r" fails, but I'm not sure.
 
I finally remember the reason for the reboot. If there is a power outage that outlasts the MBAs battery life it will not restart when power resumes. However, if you schedule a restart, it will start up again. I couldn't figure out any other way to get the machine back up after a long power outage.
 
If this command results in "not supported" then there's no easy way, unfortunately. I don't think any Macbooks support it. Your workaround is quite clever!

> sudo systemsetup -getrestartpowerfailure
 
I finally remember the reason for the reboot. If there is a power outage that outlasts the MBAs battery life it will not restart when power resumes. However, if you schedule a restart, it will start up again. I couldn't figure out any other way to get the machine back up after a long power outage.
Rather than scheduling a restart, try scheduling a power on. That way if the computer shuts down, it’ll turn itself on, but should stay on if it’s already on.
 
Rather than scheduling a restart, try scheduling a power on. That way if the computer shuts down, it’ll turn itself on, but should stay on if it’s already on.

It seems like I would have done that if the option were available. I don't have a similar machine to look at now. But, I see on a 2009 MacMini running El Cap that there is a "Start up or Wake" scheduling option. If I have that on the MBA it would probably do the trick.
 
It seems like I would have done that if the option were available. I don't have a similar machine to look at now. But, I see on a 2009 MacMini running El Cap that there is a "Start up or Wake" scheduling option. If I have that on the MBA it would probably do the trick.
I only have a 2018 MacBook Pro convenient to me at the moment, and it has the start up or wake option, so I’d expect that the Air will as well.
 
I'm still trying to think why I wouldn't have used that....

Thanks to all. Now, if I can only get there to fix it and start enjoying this again:

Cha Am Cam

That's what the MBA does 24/7.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.