Bug 21517 - start|stop script for upsd (/usr/local/etc/rc.d/upsd.sh)
Summary: start|stop script for upsd (/usr/local/etc/rc.d/upsd.sh)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-09-24 16:30 UTC by Stephen Beitzel
Modified: 2001-01-13 02:01 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Beitzel 2000-09-24 16:30:01 UTC
	upsd (/usr/ports/sysutils/upsd) does not have a startup/shutdown
	script for placement into /usr/local/etc/rc.d. So, after doing a
	'make install' for this port there's nothing that will make sure
	that upsd is running after a reboot.

Fix: 

I wrote a simple script to manage upsd. This goes into the
	/usr/local/etc/rc.d directory.
-----
#!/bin/sh

case "$1" in
start)
	echo -n ' upsd'
	/usr/local/sbin/upsd
	;;
stop)
	[ -f /var/run/upsd.pid ] && kill -TERM `cat /var/run/upsd.pid` && echo -n ' upsd'
	;;
*)
	echo "Usage: `basename $0` {start|stop}" >&2
	;;
esac

exit 0
Comment 1 sbeitzel 2000-09-26 07:49:26 UTC
After looking at the code (c.f. PR ports/21556) I saw that upsd doesn't
understand SIGTERM. So the shutdown script should use SIGQUIT (which the
daemon does recognize) instead.

Here's the patch to my posted script:

--- upsd.sh     Mon Sep 25 23:45:40 2000
+++ /usr/local/etc/rc.d/upsd.sh Mon Sep 25 17:12:15 2000
@@ -6,7 +6,7 @@
        /usr/local/sbin/upsd
        ;;
 stop)
-       [ -f /var/run/upsd.pid ] && kill -TERM `cat /var/run/upsd.pid`
&& echo -n ' upsd'
+       [ -f /var/run/upsd.pid ] && kill -QUIT `cat /var/run/upsd.pid`
&& echo -n ' upsd'
        ;;
 *)
        echo "Usage: `basename $0` {start|stop}" >&2
Comment 2 jeh freebsd_committer freebsd_triage 2001-01-13 02:01:14 UTC
State Changed
From-To: open->closed

Committed with updates.  Thanks.