On Jun 9, 2017, at 4:47 AM, Robbie van der Walle <rvanderwalle at gmail.com> wrote:> >> Under System Preferences, Energy Saver, there is a setting Start up automatically after a power failure. >> Running sudo pmset -a autorestart 1 does the same trick. > > But unfortunately Mac stays . Step 7 >You might want to save off the output of "pmset -g" before experimenting further - that way, after you find a solution, you can run it again to see what changed. This page implies that the "sudo" and "-a" are not needed: http://www.virtuallyghetto.com/2013/02/enable-auto-startup-after-power-failure.html Also potentially useful, though I can't imagine it is changing different settings under the hood: https://macminicolo.net/blog/files/Be-sure-your-Mac-mini-will-restart-automatically-when-needed.html Alternatively, on 10.12 and 10.11, there is a "-u" option to shutdown: -u The system is halted up until the point of removing system power, but waits before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power. This simulates a dirty shutdown to permit a later automatic power on. OS X uses this mode automatically with supported UPSs in emergency shutdowns. Let us know what works. (I have NUT set up on a Mac Mini, but we do not get frequent power outages, and the machine is set to wake up on a schedule anyway.)
> Alternatively, on 10.12 and 10.11, there is a "-u" option to shutdown: > > -u The system is halted up until the point of removing system power, but waits before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power. This simulates a dirty shutdown to permit a later automatic power on. OS X uses this mode automatically with supported UPSs in emergency shutdowns. > > Let us know what works. (I have NUT set up on a Mac Mini, but we do not get frequent power outages, and the machine is set to wake up on a schedule anyway.)SHUTDOWNCMD "/sbin/shutdown -u -h +0? in upsmon.conf on the Mac did the trick. Thanks! After power is restored, the Mac starts. What I wonder if the shutdown is done proper. Does the shutdown command use umount to prevent disk corruption? I also have to find a solution for starting up upsmon when the Mac starts and also still open is the notification on the Mac. But thanks so much all for the steps so far. Kind Regards, Rob> On 9 Jun 2017, at 14:42, Charles Lepple <clepple at gmail.com> wrote: > > On Jun 9, 2017, at 4:47 AM, Robbie van der Walle <rvanderwalle at gmail.com> wrote: >> >>> Under System Preferences, Energy Saver, there is a setting Start up automatically after a power failure. >>> Running sudo pmset -a autorestart 1 does the same trick. >> >> But unfortunately Mac stays . Step 7 >> > > You might want to save off the output of "pmset -g" before experimenting further - that way, after you find a solution, you can run it again to see what changed. > > This page implies that the "sudo" and "-a" are not needed: > > http://www.virtuallyghetto.com/2013/02/enable-auto-startup-after-power-failure.html > > Also potentially useful, though I can't imagine it is changing different settings under the hood: > > https://macminicolo.net/blog/files/Be-sure-your-Mac-mini-will-restart-automatically-when-needed.html > > Alternatively, on 10.12 and 10.11, there is a "-u" option to shutdown: > > -u The system is halted up until the point of removing system power, but waits before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power. This simulates a dirty shutdown to permit a later automatic power on. OS X uses this mode automatically with supported UPSs in emergency shutdowns. > > Let us know what works. (I have NUT set up on a Mac Mini, but we do not get frequent power outages, and the machine is set to wake up on a schedule anyway.)-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3583 bytes Desc: not available URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20170609/188a252b/attachment.bin>
On Jun 9, 2017, at 1:58 PM, Robbie van der Walle <rvanderwalle at gmail.com> wrote:> > What I wonder if the shutdown is done proper. Does the shutdown command use umount to prevent disk corruption?Yes, it prevents filesystem corruption, but I am not sure if it bothers to save the desktop state. You can check the "last" logs to see if it was cleanly shut down: $ last shutdown reboot reboot ~ Sun May 21 19:04 shutdown ~ Sun May 21 19:03 ... If you see a "reboot" without a corresponding "shutdown" before it, the system did not shut down properly.> I also have to find a solution for starting up upsmon when the Mac startsI never finished the integration for this branch, but... https://github.com/networkupstools/nut/compare/osx_launchd You can save off the Raw file, and replace @SBINDIR@ with /sw/sbin or whatever: https://github.com/networkupstools/nut/blob/161efce6c6fc32f205817ca71f8963af253cec59/scripts/launchd/org.networkupstools.upsmon.plist.in> and also still open is the notification on the Mac.I used to have a script that would send UDP notifications to Growl, but that was before OS X notifications made Growl mostly obsolete. I can dig that up if it is of interest.
On Fri, 9 Jun 2017, Robbie van der Walle wrote:> ... and also still open is the notification on the Mac.If notify-send is available on the Mac, then perhaps this will work: In upsmon.conf on the Mac you need NOTIFYCMD /usr/sbin/upssched (or wherever this goes on a Mac) NOTIFYFLAG ONBATT SYSLOG+EXEC In upssched.conf you need CMDSCRIPT /usr/sbin/upssched-cmd (or wherever this goes on a Mac) AT ONBATT UPS at NAS EXECUTE on-battery In upssched-cmd you need case $1 in (on-battery) MSG="Power failure. Save your work!" notify-send -a nut -u critical -t 600000 $MSG ;; (*) logger -i -t upssched-cmd "Unrecognized command: \"$1\"." ;; esac Roger