Protection from power failures! Mac, UPS, NAS & NUT

If you watched my YouTube video on protection from power failures (here), you know I promised to include the configuration files and commands on this blog.  So here they are:

To hide the ‘ups’ user:

sudo dscl . create /Users/ups IsHidden 1

 

In the upsmon.conf file, enter the following lines:

 

RUN_AS_USER ups

in the RUN_AS_USER <userid> section, and

MONITOR qnapups@192.168.1.20 1 upsmon 123456 slave

in the MONITOR <system> <powervalue> <username> <password> (“master”|”slave”) section.  I didn’t change anything else from the sample file provided with the software.

My org.networkupstools.nut.plist file looks like this:

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”&gt;
<plist version=”1.0″>
<dict>
<key>Label</key>
<string>org.networkupstools.upsmon</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/ups/sbin/upsmon</string>
<string>-D</string>
</array>
</dict>
</plist>

and it is located in the /Library/LaunchDaemons directory.

The command to load the daemon automatically on startup is:

sudo launchctl load /Library/LaunchDaemons/org.networkupstools.nut.plist

Hope you enjoyed the video tutorial and I hope it’s useful to you!

Michael

 

 

24 thoughts on “Protection from power failures! Mac, UPS, NAS & NUT

  1. Hi, I got a “/Library/LaunchDaemons/org.networkupstools.nut.plist: Invalid property list” message running the final Teminal command
    Additionally, I do not know, where can I see on the Mac the working connection to the UPS of the NAS. I have a Synology NAS, not a QNAP, but I think it does not matter.

    Like

      1. Hi, in the final step I have the same error as Zsolt, so I get the error “/Library/LaunchDaemons/org.networkupstools.nut.plist: Invalid property list”

        Any ideas?

        Like

      2. I put this in the plist. So I already corrected the mistake “>”

        Label
        org.networkupstools.upsmon
        OnDemand

        ProgramArguments

        /usr/local/ups/sbin/upsmon
        -D

        Like

      3. Michael,

        Like others I am getting “Invalid property list” even though I have double triple checked the plist. Any suggestions or ideas will really help.

        Like

      4. Hi Michael, do you already have any solution or idea for the invalid property list error. Would be awesome.

        Thanks a lot and best regards,
        Leon

        Like

      5. Leon,

        I believe you are facing the same issue as I did. Here is what worked for me and hope helps you out as well:

        1. Use ‘nano’ type of editing software for all your files like the plist, upamon.conf, etc. My issue with “Invalid property list” was resolved because I recreated the plist file using nano.
        2. To avoid the issue with libraries I used “sw” as the directory where the software is installed as suggested by Michael.

        Stay healthy and take care,

        Like

    1. I noticed that my file has a small error in it. The second line should have a > symbol instead of &gt. I hope that helps. The end of the line should read:
      “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>

      Like

  2. Trying to launch the monitor in Terminal …

    $ /usr/local/ups/sbin/upsmon
    dyld: Library not loaded: /sw/lib/libupsclient.4.dylib
    Referenced from: /usr/local/ups/sbin/upsmon
    Reason: image not found

    The library is in /usr/local/ups/lib/libupsclient.4.dylib

    Like

  3. I fixed it by instead of manually insyalling th software I installed it thru Homebrew and ajusted the path in the launch daemon. Wonderful , all is good. Could not have done it without your previous work. Thanks a lot.

    Like

  4. Hi Michael,

    I am so glad to have found your article here. Seems that getting a UPS client installed on OSX is not quite so trivial as “run an app and configure”. I am also a QNAP user.

    Question: Should the “ups” user created, be standard or administrator level and what about password, should there be one ?

    thanks in advance.

    Like

  5. Michael,

    Appreciate your prompt response. My issue got fixed. Here is what I suggest to others reading this:
    1. Use ‘nano’ type of editing software for all your files like the plist, upamon.conf, etc. My issue with “Invalid property list” was resolved because I recreated the plist file using nano.
    2. To avoid the issue with libraries I used “sw” as the directory where the software is installed as suggested by Michael.

    Stay healthy and take care,

    Like

    1. Hello Michael,
      thank you for this tutorial. I followed it but I have an issue: when I launch the daemon (sudo launchctl…), Terminal asks me for a password (normal? I write mine, I have an administrator account), but I get an error: “/Library/LaunchDaemons/org.networkupstools.nut.plist: Path had bad ownership/permissions”
      Did I something wrong? What should I do now?
      Best

      Like

      1. Security in MacOS (Catalina) may have changed since I put up the tutorial. I’d check the file permissions in a terminal window by typing ls -al. You can then use chmod to change the permissions. I’m not a Unix expert, you might want to look that up. Good luck!

        Like

  6. I really appreciate the info but there seems to be a lot of unanswered questions. In particular, where did the upsmon.conf file come from and where did you put it after you edited it? The one you edited was on your desktop. Also, you had us initially download four files, but we only used one. What do we do with the files for the libraries and USB drivers?

    Thank you!

    Like

Leave a comment