Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Bash scripting question

Max <maxw@xxxxxxxxxxxxx> writes:

> Thanks Amos for the help.  The key has no passphrase, I'll try for
> verbosity on pssh.  Its as if the script is not carrying the user
> profile (root, necessary as it's a shutdown command to be triggered
> when UPS battery gets low)

I am not certain what you mean by "not carrying the user profile", but
you /could/ mean that you expect the normal .profile, environment
variables and other ephemera of an interactive login to be preserved.

cron runs commends in a very limited environment without trying to
preserve the environment or anything like that.

This can cause confusion when $PATH, $HOME and a few other variables are
not set.

It is unlikely, though, to cause a passwordless key to stop
functioning.  It might, though, interact with the pssh tool...

> This is a workaround since I can't put apcupsd on the various linuxes
> under my care.  Dependancy nightmares with Suse 10, Centos and
> FreeNAS.

Personally, when it came to dealing with UPS data over the network
I always found the NUT (Network UPS Tools) project to be a wonderful
choice.  It has very broad support (including APC) for hardware, and is
well designed and portable.

You may find that migrating to that from apcupsd will make your life
easier and happier, without needing to fiddle with cron stuff.