From: DaveC on
> In article
> <0001HW.C7F09725004B0E39B01AD9AF(a)news.eternal-september.org>,
> DaveC <invalid(a)invalid.net> wrote:
>
>>> Ok. That's not how you run it. You don't the daemon manually. After you
>>> installed it, you should have been instructed to restart the computer.
>>> After the restart, it should automatically start up on its own.
>>
>> Just following the manual...
>>
>> Making Sure apcupsd Is Running:
>> The simplest way to invoke apcupsd is from the command line by
>> entering:
>> /sbin/apcupsd
>
> Read the section carefully. That is to be done *before* you restart, I
> believe.

And it is detrimental to launch it again manually after rebooting? Again from
the manual:
"
To start apcupsd manually (as you will probably do immediately following the
installation), enter the following: (blah, blah)
"
> I take it that's a "no, I did not install libusb"?

Correct: not installed.

> While your UPS is a serial device, it's going to communicate with
> apcupsd through USB. So I'm pretty sure you will need to install libusb.

From the apcupsd mail list I subscribe to (but can't seem to get much help
from):
"
Serial. USB is only for UPSes that support USB directly... A lot of people
get confused about this. Think about it this way:
When you add a usb-serial adapter to your computer you are giving your
computer a new serial port. You are *not* giving the UPS a USB port.
"
I'm sure this is correct. I actually used the adapter to communicate with
another APC UPS last year (it's long gone now). So the process (no USB
drivers) is correct.

Thanks,
Dave

From: Jolly Roger on
In article
<0001HW.C7F09CD6004C63A2B01AD9AF(a)news.eternal-september.org>,
DaveC <invalid(a)invalid.net> wrote:

> > In article
> > <0001HW.C7F09725004B0E39B01AD9AF(a)news.eternal-september.org>,
> > DaveC <invalid(a)invalid.net> wrote:
> >
> >>> Ok. That's not how you run it. You don't the daemon manually. After you
> >>> installed it, you should have been instructed to restart the computer.
> >>> After the restart, it should automatically start up on its own.
> >>
> >> Just following the manual...
> >>
> >> Making Sure apcupsd Is Running:
> >> The simplest way to invoke apcupsd is from the command line by
> >> entering:
> >> /sbin/apcupsd
> >
> > Read the section carefully. That is to be done *before* you restart, I
> > believe.
>
> And it is detrimental to launch it again manually after rebooting?

No, I didn't say that, but if things were working correctly, and you
tried to run it manually *after* the restart, you'd definitely get an
error.

> Again from the manual:
> "
> To start apcupsd manually (as you will probably do immediately following the
> installation), enter the following: (blah, blah)
> "

Once you get the serial port thing figured out, you likely won't be
starting it manually. There is a startup item installed already that
will do that for you.

> > I take it that's a "no, I did not install libusb"?
>
> Correct: not installed.
>
> > While your UPS is a serial device, it's going to communicate with
> > apcupsd through USB. So I'm pretty sure you will need to install libusb.
>
> From the apcupsd mail list I subscribe to (but can't seem to get much help
> from):
> "
> Serial. USB is only for UPSes that support USB directly... A lot of people
> get confused about this. Think about it this way:
> When you add a usb-serial adapter to your computer you are giving your
> computer a new serial port. You are *not* giving the UPS a USB port.
> "
> I'm sure this is correct. I actually used the adapter to communicate with
> another APC UPS last year (it's long gone now). So the process (no USB
> drivers) is correct.

Ah I stand corrected then. Unfortunately all of my experience with
apcupsd is with USB devices, so other than making sure you have the
/etc/apcupsd/apcupsd.cnf file configured correctly, I'm not sure what to
tell you. It seems like the port is available, so...

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: DaveC on
Success!!!

I had not specified the directory (/dev) in the DEVICE pathname.

I now have a printout of the parameters from the UPS. Cool.

There's a lot more to do, but for now, thanks to everyone who helped me.

> Ah I stand corrected then. Unfortunately all of my experience with
> apcupsd is with USB devices, so other than making sure you have the
> /etc/apcupsd/apcupsd.cnf file configured correctly, I'm not sure what to
> tell you. It seems like the port is available, so...

There's apparently no difference between the serial and USB config files
other than choosing the appropriate parameters.

Dave

From: Jolly Roger on
In article
<0001HW.C7F0C20D00084AADB01AD9AF(a)news.eternal-september.org>,
DaveC <invalid(a)invalid.net> wrote:

> Success!!!
>
> I had not specified the directory (/dev) in the DEVICE pathname.
>
> I now have a printout of the parameters from the UPS. Cool.
>
> There's a lot more to do, but for now, thanks to everyone who helped me.
>
> > Ah I stand corrected then. Unfortunately all of my experience with
> > apcupsd is with USB devices, so other than making sure you have the
> > /etc/apcupsd/apcupsd.cnf file configured correctly, I'm not sure what to
> > tell you. It seems like the port is available, so...
>
> There's apparently no difference between the serial and USB config files
> other than choosing the appropriate parameters.
>
> Dave

Good. Glad you got it sorted. When you get into configuration and
shutdown scripts and so on, I may be able to help you out some more. : )

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: DaveC on
> Good. Glad you got it sorted. When you get into configuration and
> shutdown scripts and so on, I may be able to help you out some more. : )

I'm there. :-)

When I disconnect and reconnect the serial cable, and cut and restore mains
power, these events get logged to Console and Terminal, but I get no Growl or
alert other than those.

What mechanism tells each app to quit and OS X to Shut Down? Do all apps have
to be configured such that they cannot complain (ie, "Are you sure you want
to quit Safari?) in order to be compatible?

Below is pasted my apccontrol script.

Thanks JR,
Dave

- - -

#!/bin/sh
#
# Copyright (C) 1999-2002 Riccardo Facchetti <riccardo(a)master.oasi.gpa.it>
#
# for apcupsd release 3.14.8 (16 January 2010) - darwin
#
# platforms/darwin/apccontrol. Generated from apccontrol.in by configure.
#
# Note, this is a generic file that can be used by most
# systems. If a particular system needs to have something
# special, start with this file, and put a copy in the
# platform subdirectory.
#

#
# These variables are needed for set up the autoconf other variables.
#
prefix=/usr
exec_prefix=${prefix}

APCPID=/var/run/apcupsd.pid
APCUPSD=/sbin/apcupsd
SHUTDOWN=/sbin/shutdown
SCRIPTSHELL=/bin/sh
SCRIPTDIR=/etc/apcupsd
WALL=wall

# Log notifications using Growl, if available
GROWLSEARCH="/usr/bin/growlnotify /usr/local/bin/growlnotify
/opt/local/bin/growlnotify"
for GROWL in $GROWLSEARCH ; do
if [ -x $GROWL ] ; then
WALL="$GROWL -t Apcupsd Notice"
break
fi
done

#
# Concatenate all output from this script to the events file
# Note, the following kills the script in a power fail situation
# where the disks are mounted read-only.
# exec >>/var/log/apcupsd.events 2>&1

if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ]
then
${SCRIPTDIR}/${1} ${2} ${3} ${4}
# exit code 99 means he does not want us to do default action
if [ $? = 99 ] ; then
exit 0
fi
fi

case "$1" in
killpower)
echo "Apccontrol doing: ${APCUPSD} --killpower on UPS ${2}"
sleep 10
${APCUPSD} --killpower
echo "Apccontrol has done: ${APCUPSD} --killpower on UPS ${2}" | ${WALL}
;;
commfailure)
echo "Communications lost with UPS ${2}" | ${WALL}
;;
commok)
echo "Communications restored with UPS ${2}" | ${WALL}
;;
#
# powerout, onbattery, offbattery, mainsback events occur
# in that order.
#
powerout)
;;
onbattery)
echo "Power failure on UPS ${2}. Running on batteries." | ${WALL}
;;
offbattery)
echo "Power has returned on UPS ${2}..." | ${WALL}
;;
mainsback)
if [ -f /etc/apcupsd/powerfail ] ; then
printf "Continuing with shutdown." | ${WALL}
fi
;;
failing)
echo "Battery power exhaused on UPS ${2}. Doing shutdown." | ${WALL}
;;
timeout)
echo "Battery time limit exceeded on UPS ${2}. Doing shutdown." | ${WALL}
;;
loadlimit)
echo "Remaining battery charge below limit on UPS ${2}. Doing shutdown." |
${WALL}
;;
runlimit)
echo "Remaining battery runtime below limit on UPS ${2}. Doing shutdown." |
${WALL}
;;
doreboot)
echo "UPS ${2} initiating Reboot Sequence" | ${WALL}
${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot"
;;
doshutdown)
echo "UPS ${2} initiated Shutdown Sequence" | ${WALL}
${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown"
;;
annoyme)
echo "Power problems with UPS ${2}. Please logoff." | ${WALL}
;;
emergency)
echo "Emergency Shutdown. Possible battery failure on UPS ${2}." | ${WALL}
;;
changeme)
echo "Emergency! Batteries have failed on UPS ${2}. Change them NOW" |
${WALL}
;;
remotedown)
echo "Remote Shutdown. Beginning Shutdown Sequence." | ${WALL}
;;
startselftest)
;;
endselftest)
;;
battdetach)
;;
battattach)
;;
*) echo "Usage: ${0##*/} command"
echo " warning: this script is intended to be launched by"
echo " apcupsd and should never be launched by users."
exit 1
;;
esac