Discussion:
[Nut-upsuser] Question about recycle power of Tripp Lite UPS
Charles Lepple
2014-06-18 13:03:39 UTC
Permalink
[moving this to nut-upsuser, since other users of Tripp Lite equipment may have specific experience with this.]
We are trying to develop a mechanism to power cycle Tripp Lite UPS. When we checked the upscmd, looks like the only command we can use is shutdown.reboot(sudo upscmd -u user -p password ups shutdown.reboot). Because the PC is connected to UPS directly and we would prefer shutdown PC before power cycle the UPS. But if we run shutdown PC first it won't run the power cycle the UPS script any more. Wonder if there is a delaed power cycle command for Tripp Lite to give PC some time to shutdown itself? Attached the upscmd -l and upsc ups.
...
ups.delay.shutdown: 90
...
ups.timer.reboot: 65535
ups.timer.shutdown: 65535
You should be able to set ups.delay.shutdown to the amount of time it takes the PC to shut down (plus a buffer), then send ?shutdown.reboot? from the PC.

You can monitor the ups.timer.* variables after sending the shutdown command; they should count down.

There are some more details in the ?Shutdown scripts? section of docs/config-notes.txt, or at http://www.networkupstools.org/docs/user-manual.chunked/ar01s06.html#_shutdown_scripts

It also looks like your UPS has a watchdog. I haven?t tried this on the newer usbhid-ups models, but once you set the watchdog timer, the UPS will power-cycle the outlets if the driver does not communicate with the UPS in that timeout period.

I am not sure if the watchdog is enabled after the reboot - this is definitely one of those cases where you will want to experiment with a dummy load on the UPS (and with the PC powered from another outlet).

Does anyone else have any specific experience with these timers on a Tripp Lite UPS with usbhid-ups?
--
Charles Lepple
clepple at gmail
Mike.
2014-06-18 17:51:40 UTC
Permalink
The upsmon.conf has the option of setting RUN_AS_USER username

Might it be possible to add a similar option to the upsd.conf file?

I see the -u command-line option for both upsmon and upsd, however,
upsd doesn't seem to carry that to the configuration file, as upsmon
does.

Thanks.
Charles Lepple
2014-06-19 13:03:25 UTC
Permalink
Post by Mike.
The upsmon.conf has the option of setting RUN_AS_USER username
Might it be possible to add a similar option to the upsd.conf file?
I see the -u command-line option for both upsmon and upsd, however,
upsd doesn't seem to carry that to the configuration file, as upsmon
does.
I'll admit this does seem arbitrary, but based on a quick look at the upsd source code, the userid is looked up before the configuration file is read, and there is a chroot() in between those statements. So this will require some more investigation to see what assumptions are being made about the userid when the configuration file is processed.

I hadn't noticed this until now, since most distributions tend to have a way to pass in options to their daemons (such as /etc/nut/nut.conf on Debian/Ubuntu). What we may want to do is add some comments to nut.conf for passing "-u user" in UPSD_OPTIONS. (It's in the man page for nut.conf, though.)
--
Charles Lepple
clepple at gmail
Mike.
2014-06-19 18:10:20 UTC
Permalink
On 6/19/2014 at 9:03 AM Charles Lepple wrote:

|On Jun 18, 2014, at 1:51 PM, Mike. <the.lists at mgm51.com> wrote:
|
|> The upsmon.conf has the option of setting RUN_AS_USER username
|>
|> Might it be possible to add a similar option to the upsd.conf
file?
|>
|> I see the -u command-line option for both upsmon and upsd,
however,
|> upsd doesn't seem to carry that to the configuration file, as
upsmon
|> does.
|
|I'll admit this does seem arbitrary, but based on a quick look at
the upsd
|source code, the userid is looked up before the configuration file
is
|read, and there is a chroot() in between those statements. So this
will
|require some more investigation to see what assumptions are being
made
|about the userid when the configuration file is processed.
|
|I hadn't noticed this until now, since most distributions tend to
have a
|way to pass in options to their daemons (such as /etc/nut/nut.conf
on
|Debian/Ubuntu). What we may want to do is add some comments to
nut.conf
|for passing "-u user" in UPSD_OPTIONS. (It's in the man page for
nut.conf,
|though.)
=============

Thanks for the quick reply.

I'll give the nut.conf approach a try. It does look as if it will be
the solution I need.
Mike.
2014-06-19 18:33:08 UTC
Permalink
On 6/19/2014 at 2:10 PM Mike. wrote:

|On 6/19/2014 at 9:03 AM Charles Lepple wrote:
|
||On Jun 18, 2014, at 1:51 PM, Mike. <the.lists at mgm51.com> wrote:
||
||> The upsmon.conf has the option of setting RUN_AS_USER username
||>
||> Might it be possible to add a similar option to the upsd.conf
|file?
|| [snip]
||
||I hadn't noticed this until now, since most distributions tend to
|have a
||way to pass in options to their daemons (such as /etc/nut/nut.conf
|on
||Debian/Ubuntu). What we may want to do is add some comments to
|nut.conf
||for passing "-u user" in UPSD_OPTIONS. (It's in the man page for
|nut.conf,
||though.)
| =============
|
|Thanks for the quick reply.
|
|I'll give the nut.conf approach a try. It does look as if it will
be
|the solution I need.
=============


OK, it looks like the FreeBSD 10.0 port of NUT does not source
nut.conf in the nut startup script.

Based upon your comment, though, I was able to accomplish what I
needed by adding

command_args="-u _ups"

under the line

command="${nut_prefix}/sbin/upsd"


in /usr/local/etc/rc.d/nut which is the start/stop script for NUT.

Thanks again for your reply.

Mike.

Shen Chuan
2014-06-18 21:31:35 UTC
Permalink
Hello Charles,

Thank you for your comment. Just tried to use ups.delay.shutdown to
postpone the UPS shutdown. The thing is that if the PC shutdown first, then
the UPS, it wasn't able to send "shutdown.reboot" any more because
everything is power off after the UPS shuts down.

Also play on the watchdog for Tripp Lite. Looks like it has the command of
reset.watchdog but not enable.watchdog. Do you guys know the command to
enable the watchdog for Tripp Lite UPS(TrippLite HID 0.8)?

Thank you so much for your help

Regards

Shen
Minutekey Inc
Post by Charles Lepple
[moving this to nut-upsuser, since other users of Tripp Lite equipment may
have specific experience with this.]
We are trying to develop a mechanism to power cycle Tripp Lite UPS. When
we checked the upscmd, looks like the only command we can use is
shutdown.reboot(sudo upscmd -u user -p password ups shutdown.reboot).
Because the PC is connected to UPS directly and we would prefer shutdown PC
before power cycle the UPS. But if we run shutdown PC first it won't run
the power cycle the UPS script any more. Wonder if there is a delaed power
cycle command for Tripp Lite to give PC some time to shutdown itself?
Attached the upscmd -l and upsc ups.
...
ups.delay.shutdown: 90
...
ups.timer.reboot: 65535
ups.timer.shutdown: 65535
You should be able to set ups.delay.shutdown to the amount of time it
takes the PC to shut down (plus a buffer), then send ?shutdown.reboot? from
the PC.
You can monitor the ups.timer.* variables after sending the shutdown
command; they should count down.
There are some more details in the ?Shutdown scripts? section of
docs/config-notes.txt, or at
http://www.networkupstools.org/docs/user-manual.chunked/ar01s06.html#_shutdown_scripts
It also looks like your UPS has a watchdog. I haven?t tried this on the
newer usbhid-ups models, but once you set the watchdog timer, the UPS will
power-cycle the outlets if the driver does not communicate with the UPS in
that timeout period.
I am not sure if the watchdog is enabled after the reboot - this is
definitely one of those cases where you will want to experiment with a
dummy load on the UPS (and with the PC powered from another outlet).
Does anyone else have any specific experience with these timers on a Tripp
Lite UPS with usbhid-ups?
--
Charles Lepple
clepple at gmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20140618/f5596aab/attachment.html>
Shen Chuan
2014-06-18 22:06:23 UTC
Permalink
Hey Charles,

Just experiment something could be useful for the Tripp Lite watchdog.
After we run
upscmd -u shen -p minutekey1234% ups reset.watchdog, then do upsc

ups.watchdog.status changed from 0 to 60. Then I shutdown PC so UPS lost
connection with the driver. The UPS DID power cycle itself after around 60
secs and wakes up the PC. After the PC backed up, I checked the upsc again
and ups.watchdog.status changed back to 0.

Please let me know if you need me debug anything to share more information.

Thank you for all your help

Regards

Shen
Post by Shen Chuan
Hello Charles,
Thank you for your comment. Just tried to use ups.delay.shutdown to
postpone the UPS shutdown. The thing is that if the PC shutdown first, then
the UPS, it wasn't able to send "shutdown.reboot" any more because
everything is power off after the UPS shuts down.
Also play on the watchdog for Tripp Lite. Looks like it has the command of
reset.watchdog but not enable.watchdog. Do you guys know the command to
enable the watchdog for Tripp Lite UPS(TrippLite HID 0.8)?
Thank you so much for your help
Regards
Shen
Minutekey Inc
Post by Charles Lepple
[moving this to nut-upsuser, since other users of Tripp Lite equipment
may have specific experience with this.]
We are trying to develop a mechanism to power cycle Tripp Lite UPS.
When we checked the upscmd, looks like the only command we can use is
shutdown.reboot(sudo upscmd -u user -p password ups shutdown.reboot).
Because the PC is connected to UPS directly and we would prefer shutdown PC
before power cycle the UPS. But if we run shutdown PC first it won't run
the power cycle the UPS script any more. Wonder if there is a delaed power
cycle command for Tripp Lite to give PC some time to shutdown itself?
Attached the upscmd -l and upsc ups.
...
ups.delay.shutdown: 90
...
ups.timer.reboot: 65535
ups.timer.shutdown: 65535
You should be able to set ups.delay.shutdown to the amount of time it
takes the PC to shut down (plus a buffer), then send ?shutdown.reboot? from
the PC.
You can monitor the ups.timer.* variables after sending the shutdown
command; they should count down.
There are some more details in the ?Shutdown scripts? section of
docs/config-notes.txt, or at
http://www.networkupstools.org/docs/user-manual.chunked/ar01s06.html#_shutdown_scripts
It also looks like your UPS has a watchdog. I haven?t tried this on the
newer usbhid-ups models, but once you set the watchdog timer, the UPS will
power-cycle the outlets if the driver does not communicate with the UPS in
that timeout period.
I am not sure if the watchdog is enabled after the reboot - this is
definitely one of those cases where you will want to experiment with a
dummy load on the UPS (and with the PC powered from another outlet).
Does anyone else have any specific experience with these timers on a
Tripp Lite UPS with usbhid-ups?
--
Charles Lepple
clepple at gmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20140618/6b3d6304/attachment.html>
Charles Lepple
2014-06-18 23:31:11 UTC
Permalink
Thank you for your comment. Just tried to use ups.delay.shutdown to postpone the UPS shutdown. The thing is that if the PC shutdown first, then the UPS, it wasn't able to send "shutdown.reboot" any more because everything is power off after the UPS shuts down.
Hmm, we might need to add a line for an "ups.delay.reboot" variable that corresponds to "shutdown.reboot" command. I assumed that shutdown and reboot used the same timer value.

Try the enclosed patch?
--
Charles Lepple
clepple at gmail


-------------- next part --------------
A non-text attachment was scrubbed...
Name: tripplite-hid-reboot-delay.patch
Type: application/octet-stream
Size: 996 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20140618/1c1cb328/attachment-0001.obj>
Loading...