Once installed apcupsd normally runs as a system service. This means that it is immediately started by the operating system when the system is booted, and runs in the background even if there is no user logged into the system.
This installation assumes that you do not have CYGWIN installed on your computer. If you do, and you use mount points, you may need to do a special manual installation.
Once you have unzipped the binaries, open a window pointing to the binary installation folder (normally c:\apcupsd). This folder should contain folders with the name bin, etc, examples, and manual. If and when you no longer need them, the examples and manual sub-folders of the c:\apcupsd directory may be removed.
Continuing the installation process:
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00"
and add the following to the end of the line: /NoSerialMice:COM1 (or COM2 depending on what you want to use). The new line should look similar to:
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation Version 4.00" /NoSerialMice:COM1
where the only thing you have changed is to append to the end of the
line. This addition will prevent the operating system from
interferring with apcupsd
If everything went well, you will get something similar to the following output in a
DOS shell window:
What is important to verify in the DOS window is that the root directory \ is mounted on device c:\.
The DOS window will be followed immediately by a Windows dialogue box as follows:
cd c:\apcupsd\bin apcupsd /serviceAlternatively, you can go to the c:\apcupsd\bin folder with the Explorer and double click on the Start icon.
For WinXP systems (and probably Win2K), the dialogs are a bit different from those shown here for WinNT, but he concept is the same. You get to the Services dialog by clicking on: Control Panel -> Administrative Tools -> Component Services. The apcupsd service should appear in the right hand window when you click on Services (Local) in the left hand menu window.
That should complete the installation process. When the system tray icon
turns from a battery into a
plug
, right click on it
and a menu will appear. Select the Events item, and the Events dialogue box
should appear. There should be no error messages. By right clicking again on the
system tray plug and selecting the Status item, you can verify that all the
values for your UPS are correct.
When the UPS switches to the battery, the battery icon will reappear in the
system tray. While the UPS is online, if the battery is not at least 99% charged,
the plug icon will become a plug with a lightning bolt in the middle
to indicate
that the battery is charging.
Please read the Testing chapter of this document for general instructions on testing the Win32 version. However, on Win32 systems, there is no Unix system log file, so if something goes wrong, look in the file c:\apcupsd\etc\apcupsd\apcupsd.events where apcupsd normally logs its events, and you will generally find more detailed information on why the program is not working. The most common cause of problems is either improper configuration of the cable type, or an incorrect address for the serial port.
On WinNT systems (and Win2000 systems), you may stop apcupsd as indicated abover or alternatively you may stop apcupsd by using the Services item in the Control Panel. In addition, at least on my system, there seems to be a WinNT bug that causes the system to prevent apcupsd.exe from being overwritten even though the file is no longer being used. This is manifested by an error message when attempting load a new version and overwrite the old apcupsd.exe (the extract part of WinZip as described above). To circumvent this problem (if it happens to you), after shutting down the running version of apcupsd, through the Services dialogue in the Control Panel, first click on the Stop button:
then click on the Startup ... button, and in the Startup dialogue select the Disabled button to disable apcupsd:
After closing the dialogues, reboot the system, typical of Microsoft :-(. When the system comes back up, apcupsd will not be automatically launched as a service, and you can install the new version. To reinstate apcupsd as an automatic service, using the Control Panel: reset apcupsd to Automatic startup in the Startup dialogue, then restart apcupsd in the Services dialogue as shown above in the installation instructions. Frequently after an upgrade, you will click on the Start button and after a few seconds, the system reports that it failed to start. The cause of this problem is unknown, but the solution is simply to click again on the Start button.
The second file that you should examine is c:\apcupsd\etc\apcupsd\apccontrol. This file is called by apcupsd when events (power loss, etc) are generated. It permits the user to program handling the event. In particular, it permits the user to be notified of the events. For the Win32 version, each event is programmed to display a Windows popup dialogue box. If your machine is mostly unattended, you may want to comment out some of these popup dialogue boxes by putting a pound sign (#) in column one of the appropriate line.
MASTER my.master.com use something like:
MASTER 192.168.1.54 where you replace the IP address with your actual IP address.
Also, on WinNT systems, the PIF files in /apcupsd/bin used for starting and stopping apcupsd do not work. Use the services control panel instead.
On Win95 systems, there are reports that the PIF files do not work. If you find that to be the case, the simplest solution is to use the batch files that we have supplied in the c:/apcupsd/bin directory. Also, on Win95 systems, we have an unconfirmed report that indicates that apcupsd does not start automatically as a service even though the Registry has been properly updated. If you experience this problem, a work around is to put a shortcut to apcupsd in the StartUp folder.
As noted above, after an upgrade, you may need to start apcupsd several times before it will actually run.
On WinNT, WinXP, and Win2K systems, you can examine the System Applications log to which apcupsd writes Windows error messages during startup.
Regardless of which Windows system you are running, apcupsd logs most error messages to c:\apcupsd\etc\apcupsd\apcupsd.events. This type error messages such as configuration file not found, etc are written to this file.
Start Stop Install Uninstall ups-events ups-statusAny of these utilities may be used on any system, with the exception of the Start utility, which cannot be used on WinNT and Win2000 systems. On those systems, the apcupsd service must always be started through the Services sub-dialogue of the Control Panel.
The Install and Uninstall utilities install and uninstall apcupsd from the system registry only. All other pieces (files) of apcupsd remain intact. It is not absolutely necessary for apcupsd to be installed in the registry as it can run as a regular program. However, if it is not installed in the registry, it cannot be run as a service.
The functions of Stop, ups-events, and ups-status can be more easily invoked by right clicking on the apcupsd icon in the system tray and selecting the desired function from the popup menu.
Some items to note:
Nevertheless, it is possible to use the --kill-on-powerfail option on the apcupsd command line, but the use of this option could cause the power to be cut off while your machine is still running. See the section on Shutdown Chapter of this document for a more complete discussion of this subject. If you are still interested in trying to get this to work, please look at the code that is commented out in c:\apcupsd\etc\apcupsd\apccontrol under the doshutdown case.
An alternative to the --kill-on-powerfail option is to use the KILLDELAY configuration directive as explained in the Configuration Section of this document.
This configuration directive is appropriate on Windows machines where apcupsd continues to run even when the machine is halted (as is the case on most NT machines).
If you wish to try this program on Win95/98 systems, look at the files named changeme, commfailure, commok, onbattery, and mainsback in the directory c:\apcupsd\examples. To use them, you must modify the SYSADMIN variable to have a valid email address, then copy the files into the directory c:\apcupsd\etc\apcupsd.
This feature is implemented on Unix systems by first requesting a system shutdown. As a part of the shutdown, apcupsd is terminated by the system, but the shutdown process executes a script where apcupsd is recalled after the disks are synced and the machine is idle. Bacula then requests the UPS to shut off the power (killpower).
Unfortunately on Windows, there is no such shutdown script that we are aware of and no way for apcupsd to get control after the machine is idled. If this feature is important to you, it is possible to do it by telling apcupsd to immediately issue the killpower command after issuing the shutdown request. The danger in doing so is that if the machine is not sufficiently idled when the killpower takes place, the disks will need to be rescanned (and there is a possibility of lost data however small). Generally, UPSes have a shutdown grace period which gives sufficient time for the OS to shutdown before the power is cut.
To implement this feature, you need to add the -p option to the apcupsd command line that is executed by the system. Currently the procedure is manual. You do so by editing the registry and changing the line:
c:\apcupsd\apcupsd.exe /servicefound under the key:
HKEY_LOCAL_MACHINE Software\Microsoft\Windows\CurrentVersion\RunServicesto
c:\apcupsd\apcupsd.exe /service -pIf you have a Smart UPS, you can configure the kill power grace period, and you might want to set it to 3 minutes. If you have a dumb UPS, there is no grace period and you should not use this procedure. If you have a Back-UPS CS or ES, these UPSes generally have a fixed grace period of 2 minutes, which is probably sufficient.
Nevertheless some people prefer to do a full power down. To do so, you might want to get a copy of PsShutdown, which does have a power down option. You can find it and a lot more useful software at: http://www.sysinternals.com/ntw2k/freeware/pstools.shtml. to use their shutdown program rather than the apcupsd supplied version, you simply edit:
c:\apcupsd\etc\apcupsd\apccontrolwith any text editor and change our calls to shutdown to psshutdown.
In order to avoid option clashes between the options necessary for apcupsd to run on Windows and the standard apcupsd options, all Windows specific options are signaled with a forward slash character (/), while as usual, the standard apcupsd options are signaled with a minus (-), or a minus minus (--). All the standard apcupsd options can be used on the Windows version. In addition, the following Windows only options are implemented:
If you have the source code, follow the standard procedures for building apcupsd on Unix in the Installation Section of this manual. Please don't forget to look at the Win32 specific instructions.