NUT on OS X (10.5.7)

Please post anything pertaining to Mac and OS X compatibility issues here.

NUT on OS X (10.5.7)

Postby travelclarkie » Wed May 27, 2009 9:32 pm

I just downloaded and installed NUT onto my MacBook Pro.
I have the basics configured but I have a few questions that I am hoping someone can help me with.

1) How do I get NUT to start automatically? I found a few sites but they seemed outdated.
Help . .

2) I'd like to have the notifyme command me the localmail spool that I can use PINE to read. But I'm not sure the syntax to use.

3) What does Mac use for the shutdown command?

I think that is it for now.

Thank you
travelclarkie
ReadyNAS User
 
Posts: 84
Joined: Mon Mar 03, 2008 6:46 pm

Re: NUT on OS X (10.5.7)

Postby ericdano » Sat May 30, 2009 4:31 pm

travelclarkie wrote:I just downloaded and installed NUT onto my MacBook Pro.
I have the basics configured but I have a few questions that I am hoping someone can help me with.

1) How do I get NUT to start automatically? I found a few sites but they seemed outdated.
Help . .

2) I'd like to have the notifyme command me the localmail spool that I can use PINE to read. But I'm not sure the syntax to use.

3) What does Mac use for the shutdown command?


What is NUT?

the command would be "shutdown now" but you need to be su to do it, so "sudo shutdown now"
ericdano
Advanced ReadyNAS Expert
 
Posts: 556
Joined: Mon Jul 24, 2006 1:06 pm
ReadyNAS: 600

Re: NUT on OS X (10.5.7)

Postby travelclarkie » Sat May 30, 2009 6:01 pm

NUT is Network UPS Tool

It's a client/server UPS monitoring/control program. I want to monitor my readynas and when the it shutsdown due to going on to a UPS turn my computer off

Thank you for the shutdown command. Now another question for others out there if shutdown needs admin access how do you make NUT play nice?
travelclarkie
ReadyNAS User
 
Posts: 84
Joined: Mon Mar 03, 2008 6:46 pm

Re: NUT on OS X (10.5.7)

Postby ericdano » Sat May 30, 2009 6:10 pm

travelclarkie wrote:NUT is Network UPS Tool

It's a client/server UPS monitoring/control program. I want to monitor my readynas and when the it shutsdown due to going on to a UPS turn my computer off

Thank you for the shutdown command. Now another question for others out there if shutdown needs admin access how do you make NUT play nice?


I have no clue. You might want to look on google http://web.suffieldacademy.org/ils/netadmin/docs/software/nut/
or http://boxster.ghz.cc/projects/nut/wiki/NutOnMacOSX

I have my NAS on it's own UPS, and the Mac on it's own. You might want to maybe set them both to shutdown within a few minutes of losing power? Say 20? I think my NAS says it can run 40 some minutes on battery power. The Mac.......no clue. But I have it set to shutdown with 5 minutes or less of estimated battery time.
ericdano
Advanced ReadyNAS Expert
 
Posts: 556
Joined: Mon Jul 24, 2006 1:06 pm
ReadyNAS: 600

Re: NUT on OS X (10.5.7)

Postby Egg » Mon Jun 15, 2009 7:45 am

Setup: ReadyNAS NV+ 4.1.4 and MacMini OS X (10.5.7) on the same UPS (APC Back-UPS RS 800)

ReadyNAS NV+ 4.1.4 acts as the NUT server, connected via USB to the UPS, MacMini as a NUT client.

NOTE: ACPUSPd (http://www.apcupsd.com) can not communicate with NUT!
(Yes its somewhere mentioned in one of the posts in another forum, just to avoid trotting down this wrong path, cost me half a day to figure that one out...)

In order to get NUT on the MacMini installed, download Fink (http://www.finkproject.org) and use the Fink Commander to install the BINARY of NUT.

http://boxster.ghz.cc/projects/nut/wiki/NutOnMacOSX describes to download the source code, its not necessary anymore there is a binary now available.

In order to run only the NUT client (which is what I wanted) one needs to create the upsmon.config file in the /sw/etc/nut directory.

Open Terminal:
Code: Select all
cd /sw/etc/nut
sudo vi upsmon.conf.sample


Change the values according to dbott67s advice for WinNut and quit vi by writing first the changed content to the new file 'upsmon.conf'.

http://www.readynas.com/forum/viewtopic.php?f=11&t=16744&p=89080&hilit=Winnut+configuration#p89080

Code: Select all
:w upsmon.conf
:q!


In order to test that the NUT client actually works, use Terminal again and start upsmon manually:
Code: Select all
sudo upsmon


The following is slightly altered advise based on http://boxster.ghz.cc/projects/nut/wiki/NutOnMacOSX.

Now you should be able to see two upsmon processes in the Activity Monitor one running as root, the other as nobody.

In Terminal enter the following to test the connection from your Mac via your ReadyNAS to the UPS:
Code: Select all
sudo upsc UPS@Your_ReadyNAS_IP


In the Terminal window you should get a response back based on the type of your UPS device.

Automatic Startup

I repeat here the advise from boxster but updated to the fact that this is for 10.5.7 and we only need the NUT client service to run.


For OS X it is necessary to navigate to /System/Library/StartupItems. I started by copying another directory tree (I used 'NFS') as a template for 'UPS' directory. Then I changed to the 'UPS' directory and renamed the 'NFS' file to 'UPS' using the mv command. And last I edited the files in the 'UPS' directory.

These are the terminal commands:

cd /System/Library/StartupItems
sudo cp -R NFS UPS
cd UPS
ls
sudo mv NFS UPS
sudo vi UPS


Hint: If you shouldn't have NFS in your StartupItems folder use one which is there. (My apologies, I'm a noob so I write for noobs)


Code: Select all
#!/bin/sh

##
# UPS Monitor script
# Using Network UPS Tools executables
# based on script by David Hough
# @ http://www.llondel.org/ups.shtml
# Note that fink executables cannot use Apple's rc.common routines
# and fink binaries don't keep their pid files in the standard OS X location
##

FINK_BIN=/sw/sbin

case $1 in
                start  )

                ${FINK_BIN}/upsmon
;;

                stop  )

                ${FINK_BIN}/upsmon -c stop
;;

                restart  )

                $0 stop
                $0 start
;;

esac


Just to be clear: thats the content of the file 'UPS' within /Library/StartupItems/UPS

StartupParamerters.plist in the same location has to be changed to the following:
Code: Select all
?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">
<plist version="1.0">
<dict>
        <key>Description</key>
        <string>UPS Monitor client (NUT)</string>
        <key>Messages</key>
        <dict>
                <key>start</key>
                <string>Starting UPS Monitor client (NUT)</string>
                <key>stop</key>
                <string>Stopping UPS Monitor client (NUT)</string>
        </dict>
        <key>OrderPreference</key>
        <string>None</string>
        <key>Provides</key>
        <array>
                <string>UPS</string>
        </array>
        <key>Requires</key>
        <array>
                <string>Resolver</string>
        </array>
</dict>
</plist>


That's it! Now the automatic start-up should work.

Last but not least don't forget to follow the advise from boxster to secure NUT ...
Egg
ReadyNAS Newbie
 
Posts: 8
Joined: Mon Jun 15, 2009 5:31 am

Re: NUT on OS X (10.5.7)

Postby travelclarkie » Tue Jun 16, 2009 4:16 pm

Thank you for the information. I'll have to try things out tonight.
travelclarkie
ReadyNAS User
 
Posts: 84
Joined: Mon Mar 03, 2008 6:46 pm


Return to Mac / OS X



Who is online

Users browsing this forum: No registered users and 3 guests