October 2, 200817 yr if you have really strong stomach, check out this slightly more complicated "sed" script: I'm pretty amazed at how complex a sed script can be. My Stomach just isn't that strong... LOL!!!
October 2, 200817 yr RJ-45 on the other end? I admit all my APC UPSs are serial, and the only one I have with USB is a Tripp-Lite, the Tripp-lite has a regular USB port. The RJ-45 and RJ-12 jacks on a UPS are usually for surge suppression on the phone and ethernet.
October 2, 200817 yr Yah. There's no USB port on the UPS and there are other ports for network and phone line. The one I'm talking about they call a Data Port. Here's a shot of the back: http://www.apcc.com/products/moreimages.cfm?partnum=BX1300LCD
October 2, 200817 yr RJ-45 on the other end? I admit all my APC UPSs are serial, and the only one I have with USB is a Tripp-Lite, the Tripp-lite has a regular USB port. The RJ-45 and RJ-12 jacks on a UPS are usually for surge suppression on the phone and ethernet. My APC Back-UPS ES 750 cable is the same way, with an RJ45 connector on one end and a USB on the other. Probably a cost savings measure. They do warn against plugging in the wrong cable...
October 2, 200817 yr I'll try changing a couple things in the config file when I get home. I figure I'll try changing cable type from SMART to USB and see if that works but can someone tell me what to put in my go file that will copy my custom version over the original on bootup? I tried to find a version dated close to Joes, but all the ones I fond are either quite a bit newer or much older.
October 2, 200817 yr I'll try changing a couple things in the config file when I get home. I figure I'll try changing cable type from SMART to USB and see if that works but can someone tell me what to put in my go file that will copy my custom version over the original on bootup? I tried to find a version dated close to Joes, but all the ones I fond are either quite a bit newer or much older. unlike MS-Dos, or windows, the date on the file in Linux is the date it was created on that specific machine. So, I downloaded the package on the date shown in my "ls" command, you probably did the same. What is important is the version, (in this case, you seem to have the same version as me) If you do a checksum, you can be sure if we have the same versions or not. cd /boot/packages (or wherever you have you package file) md5sum apcupsd-3.14.3-i486-1kjz.tgz 98ef68509ed27848f3a8782784d42c42 apcupsd-3.14.3-i486-1kjz.tgz Same md5sum, exact same install package. To copy an edited apcupsd config file from the flash drive to the /etc/apcupsd folder use a series of lines like this in your go script: (assuming you have an edited version of the apcupsd.conf file on the flash drive) installpkg /boot/apcupsd-3.14.3-i486-1kjz.tgz cp /boot/apcupsd.conf /etc/apcupsd/ /sbin/apcupsd Do the copy (cp) before you invoke the apcupsd program (third line above), otherwise, it will use the un-edited version. Do the copy after you invoke installpkg (first line above), otherwise the installpackage program will overwrite the edited copy you put in place with its original version. Joe L.
October 3, 200817 yr Our checksums match. Wouldn't that also mean they are configured identically? I altered the script as you showed. I assumed I had to remove the two sed lines from the one you posted earlier. Anyway, here is what my script now looks like: #! /bin/bash # Install APC UPS driver module cd /boot/packages installpkg apcupsd-3.14.3-i486-1kjz.tgz cp /boot/apcupsd.conf /etc/apcupsd/ /sbin/apcupsd #Now, put into place the shutdown script replacement echo "/sbin/powerdown" >/etc/apcupsd/doshutdown echo "exit 99" >>/etc/apcupsd/doshutdown chmod 755 /etc/apcupsd/doshutdown I edited the apcupsd.conf file (changed the cord type from "smart" to "usb") and saved it to /boot/. I then ran: Linux 2.6.24.4-unRAID. root@Tower1:/boot# S120-apcupsd-package-install.sh Installing package apcupsd-3.14.3-i486-1kjz... PACKAGE DESCRIPTION: apcupsd: apcupsd - A daemon for controlling APC UPS devices apcupsd: apcupsd: Apcupsd can be used for power management and controlling most of apcupsd: APC's UPS models on Unix and Windows machines. Apcupsd works with apcupsd: most of APC's Smart-UPS models as well as most simple signalling apcupsd: models such as Back-UPS and BackUPS-Office. apcupsd: apcupsd: Requires: gd, libjpeg, libpng, ncurses apcupsd: Homepage: http://www.apcupsd.org/ apcupsd: apcupsd: Packaged by Ken Zalewski ([email protected]) Executing install script for apcupsd-3.14.3-i486-1kjz... root@Tower1:/boot# apcaccess status Error contacting host localhost port 3551: Connection refused After running the script, I checked /etc/apcupsd/apcupsd.conf and it contained my change so the script indeed copied the file, but as you can see I'm still getting the same error. Anybody have any ideas what I can do to get this working?
October 3, 200817 yr You have to start the daemon before running apcaccess. /sbin/apcupsd then run ps -eaf | grep apc and see if the daemon running. Then you can run apcaccess status
October 3, 200817 yr You have to start the daemon before running apcaccess. /sbin/apcupsd Didn't the sixth line of my script do that? I just checked it: Linux 2.6.24.4-unRAID. root@Tower1:~# ps -eaf | grep apc root 2420 2408 0 21:06 pts/0 00:00:00 grep apc root@Tower1:~# Is that the proper response if it's running?
October 3, 200817 yr Nope.. it's not running... you should see something like this: root@b3:~# ps -eaf | grep apc root 1650 1 0 Sep30 ? 00:00:02 /sbin/apcupsd root 13435 13419 0 21:27 pts/0 00:00:00 grep apc If apcupsd dies after you run it, check the apcupsd log.
October 3, 200817 yr Thanks. From looking I gather the file is apcupsd.events. Here's what it says: Thu Oct 02 20:23:42 GMT+8 2008 apcupsd FATAL ERROR in linux-usb.c at line 609 Cannot find UPS device -- For a link to detailed USB trouble shooting information, please see <http://www.apcupsd.com/support.html>. Thu Oct 02 20:23:42 GMT+8 2008 apcupsd error shutdown completed
October 3, 200817 yr I went to the site listed in the log and have been reading the USB configuration section of the manual. It said to run... cat /proc/bus/usb/devices and make sure the unit is listed. Mine shows up there. Then it said, "The important things to check for are the S: lines describing your UPS and and the I: line showing what driver is handling it. If on the I: line, Driver is listed as Driver=none then you do not have the HID driver loaded or the driver did not attach to the UPS." My I: line reported "Driver=none". Then it said to check that the correct drivers are loaded by typing: ls -l /sys/bus/usb/drivers/ It said you should get something like this: total 0 drwxr-xr-x 2 root root 0 May 1 18:55 hid drwxr-xr-x 2 root root 0 May 1 18:55 hiddev drwxr-xr-x 2 root root 0 May 1 18:55 hub drwxr-xr-x 2 root root 0 May 1 18:55 usb drwxr-xr-x 2 root root 0 May 1 18:55 usbfs or total 0 drwxr-xr-x 2 root root 0 Jan 6 15:27 hiddev drwxr-xr-x 2 root root 0 Jan 6 15:28 hub drwxr-xr-x 2 root root 0 Jan 6 15:28 usb drwxr-xr-x 2 root root 0 Jan 6 15:27 usbfs drwxr-xr-x 2 root root 0 Jan 6 15:28 usbhid When I run it I get: total 0 drwxr-xr-x 2 root root 0 Oct 3 12:18 hub/ drwxr-xr-x 2 root root 0 Oct 3 12:18 usb/ drwxr-xr-x 2 root root 0 Oct 3 12:18 usb-storage/ drwxr-xr-x 2 root root 0 Oct 3 12:18 usbfs/ drwxr-xr-x 2 root root 0 Oct 3 12:18 usbhid/ It would appear that the missing hiddev is the problem. This is what they have to say next: Apcupsd accesses USB UPSes via the hiddev device nodes. Typically these are located in /dev/hiddevN, /dev/usb/hiddevN or /dev/usb/hiddev/hiddevN (where N is a digit 0 thru 9). Some distributions (some Debian releases, possibly others) do not provides these device nodes for you, so you will have to make them yourself. Check /dev, /dev/usb, and /dev/usb/hiddev and if you cannot find the hiddevN nodes, run (as root) the examples/make-hiddev script from the apcupsd source distribution. I don't see /dev/hiddevN or /dev/usb. I found /dev/bus/usb, but nothing within that looked like anything they are talking about. Any suggestions? Should I seek out this script they're talking about and try running it?
October 3, 200817 yr OK I did that and I can see it added the files, but hiddev is still missing when I run: ls -l /sys/bus/usb/drivers/ The manual then says this: Some early 2.6 distributions (Fedora Core 3, for one) do not include hiddev rules in their default udev rule set. The bottom line for apcupsd on such a system is that if the hiddevN is not created when you plug in your UPS, apcupsd will terminate with an error. The solution to the problem is to add a rule to the udev rules file. On Fedora FC3, this file is found in /etc/udev/rules.d/50-udev.rules. Start by adding the following line: BUS="usb", SYSFS{idVendor}="051d", NAME="usb/hiddev%n" (Note that this rule uses obsolete udev syntax and is specific to FC3 and other distributions of similar vintage.) Then either reboot your system, or unplug and replug your UPS and then restart apcupsd. At that point a /dev/usb/hiddevN node should appear and apcupsd should work fine. Should I add this line to that file? I'm just leary because of the bold line. Also, am I correct in assuming that the make-hiddev script will need to be put in the go file to run on every boot? If I should add the above line to the 50-udev.rules file will the change stick on reboot or will that need to be accounted for in a script?
October 3, 200817 yr hiddev was added to the unRAID release in v4.3.2, see http://lime-technology.com/forum/index.php?topic=2190.msg16348#msg16348.
October 3, 200817 yr Thanks a ton! I upgraded to 4.3.3 and I now see results when I type: apcaccess status Now on to the getting the rest working. Thanks again.
October 3, 200817 yr I am using Joe L.'s script containing: #! /bin/bash # Install APC UPS driver module cd /boot/packages installpkg apcupsd-3.14.3-i486-1kjz.tgz sed -i -e "s/^DEVICE \/dev\/ttyS0/#DEVICE \/dev\/ttyS0/" /etc/apcupsd/apcupsd.conf sed -i -e "s/WALL=wall/WALL=\"mail -s 'unRAID_Server_UPS_Alert'\"/" /etc/apcupsd/apccontrol /sbin/apcupsd #Now, put into place the shutdown script replacement echo "/sbin/powerdown" >/etc/apcupsd/doshutdown echo "exit 99" >>/etc/apcupsd/doshutdown chmod 755 /etc/apcupsd/doshutdown What tells the script when to powerdown? Am I ready to test it or do I still need something else? What's the best way to test it to see if it works?
October 3, 200817 yr The best way to test it is to plug the UPS into a power strip with a switch, so you don't have to break the ground connection to cut power to the UPS. Then plug the server into a different outlet, so it stays hot. Boot up the machine, then stop the array, so you don't invoke a parity check if it doesn't shut down cleanly. Cut power to the ups, and watch the console to see if it invokes a clean powerdown. The server should be plugged into a non switched source for this test, and the UPS signal cable plugged into the server.
October 4, 200817 yr If you don't want to hunt for a switched outlet, you can use an outlet strip with a switch on it. Also, you need to plug something into the ups to use th e battery.... with no load, it may run for hours on the battery!
October 4, 200817 yr Halogen work lamps make very good loads for testing purposes. Just make sure you don't put more than 80% or so of the VA load rating on the UPS.
October 4, 200817 yr Thanks for all the help everybody! I just tested the UPS as recommended, and it worked fine. The shutdown script was invoked and it shutdown properly when I left the array running. No parity check on start up! This is real peace of mind. Just two last questions: 1. I downloaded the mail scriptand was configuring it, but where do you enter the "to" address? 2. My UPS seems powerful enough to handle both my servers. How can you make them both shutdown properly when plugged into the same UPS?
Archived
This topic is now archived and is closed to further replies.