/[ports]/head/sysutils/apcupsd/files/apcupsd.sh.sample
ViewVC logotype

Contents of /head/sysutils/apcupsd/files/apcupsd.sh.sample

Parent Directory Parent Directory | Revision Log Revision Log


Revision 50851 - (show annotations) (download)
Sun Dec 2 11:24:53 2001 UTC (22 years, 7 months ago) by lkoeller
File size: 1302 byte(s)
Add apcupsd 3.8.3, a daemon for controlling APC UPS.

PR:		31478
Submitted by:	Lars Koeller <Lars.Koeller@Uni-Bielefeld.DE>

1 #!/bin/sh
2 # $FreeBSD$
3 # startup scripts for APCUPSD.
4
5 if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
6 echo "$0: Cannot determine the PREFIX" >&2
7 exit 1
8 fi
9
10 # If there is a global system configuration file, suck it in.
11 if [ -r /etc/defaults/rc.conf ]; then
12 . /etc/defaults/rc.conf
13 source_rc_confs
14 elif [ -r /etc/rc.conf ]; then
15 . /etc/rc.conf
16 fi
17
18 apcupsd_enable=${apcupsd_enable:-YES}
19 apcupsd_program=${apcupsd_program:-${PREFIX}/sbin/apcupsd}
20 apcupsd_flags=${apcupsd_flags:-"--kill-on-powerfail"}
21 apcupsd_pidfile=${apcupsd_pidfile:-/var/run/apcupsd.pid}
22 apcupsd_lockfile=${apcupsd_pidfile:-/var/spool/lock/apcupsd.lock
23
24 case $1 in
25 start)
26 case "${apcupsd_enable}" in
27 [Yy][Ee][Ss])
28 rm -f /var/run/powerfail
29 rm -f /var/run/nologin
30 if [ -f ${apcupsd_program} ]; then
31 echo -n " apcupsd"
32 ${apcupsd_program} ${apcupsd_flags} || return=" Failed."
33 touch ${apcupsd_lockfile}
34 fi
35 ;;
36 esac
37 ;;
38
39 stop)
40 if [ -f ${apcupsd_pidfile} ]; then
41 PID=`cat ${apcupsd_pidfile}`
42 kill -KILL $PID || return=" Failed."
43 rm -f ${apcupsd_pidfile}
44 else
45 return=" Failed."
46 fi
47 ;;
48
49 restart)
50 $0 stop
51 $0 start;
52 ;;
53
54 status)
55 ${PREFIX}/sbin/apcaccess status
56 ;;
57
58 *)
59 echo "usage: $0 {start|stop|restart|status}" 1>&2
60 ;;
61 esac
62
63 exit 0;

Properties

Name Value
cvs2svn:cvs-rev 1.1
svn:keywords FreeBSD=%H

  ViewVC Help
Powered by ViewVC 1.1.27