Problem
"mkdev apc" is run to configure the system to start the UPS
(uninterruptible power supply) daemon "ssd" when the system
enters multiuser mode. It creates the /etc/rc2.d/S99apcssd
script. On the first change to multiuser mode, after configuring
this daemon, S99apcssd correctly starts the ssd daemon automatically.
However, on subsequent reboots or changes to multiuser mode, the
daemon fails to start. The console displays the message:Only one copy of ssd may be running at a time APC UPS Monitoring Daemon active
Cause
The /usr/lib/apc/ssd binary writes out an ssd.pid lock file to
the current working directory on starting the daemon. When the
/etc/rc2.d/S99apcssd startup script is run, it checks to see if
there is a daemon already running, by looking for the ssd.pid
file. If it exists, then it will kill the process id (contained
in the file) and delete the ssd.pid file. This allows the
/usr/lib/apc/ssd binary to run as a single instance.The /etc/rc2.d/S99apcssd script is checking the apc install directory (/usr/lib/apc) for the ssd.pid file before deleting it, but the ssd binary writes the ssd.pid file to the current working directory. On startup, the /etc/rc2.d scripts are run from root's home directory, so the ssd.pid file gets written to /.
Therefore, the startup script fails to remove the lockfile in / but
when the ssd binary is called it detects the lockfile in / and
doesn't start the daemon. It believes that an instance of the
daemon is already running when, in fact, one is not. Solution
Once the system is in multiuser mode, the daemon can be manually started by the root user as follows:
cd /
rm ssd.pid
/etc/rc2.d/S99apcssd startConfirm the daemon is running with:ps -ef | grep ssdYou should see a line containing:/usr/lib/apc/ssd /usr/lib/apc/ssd.iniAlternatively, the startup script /etc/rc2.d/S99apcssd can be modified so that any references to the ssd.pid file refer to it in the root directory. This would allow the system to automatically start the daemon on reboot or a change to multiuser mode. The script would read as follows:
#!/bin/sh
# @(#)S99apcssd 25.2 94/10/14
# Copyright 1994, American Power Conversion, Inc.ACTIVITY_STRING=
INSTALL_PATH=/usr/lib/apc
CONFIG_FILE=ssd.inikill_it() {
set `cat /ssd.pid`
kill -INT $1 1>/dev/null 2>&1case "$1" in
start)
if [ -r $INSTALL_PATH/ACTIVE ]
then
ACTIVITY_STRING="ACTIVE"
if [ -s /ssd.pid ]
then
kill_it;
rm -f /ssd.pid
fi
$INSTALL_PATH/ssd $INSTALL_PATH/ssd.ini &
echo "APC UPS Monitoring Daemon active"
else
ACTIVITY_STRING="INACTIVE"
fistop)
if [ -r /ssd.pid ]
then
kill_it;
fiecho "Usage S99apcssd [start|stop]"esacNOTES: The /usr/lib/apc/ssd daemon can be started from any current
working directory but you will need to keep an eye on the ssd.pid
file, which gets written out to that directory.This problem has been reported to SCO Engineering and is scheduled to be addressed in a future release.