diff options
Diffstat (limited to 'sysutils/apcupsd/files')
-rw-r--r-- | sysutils/apcupsd/files/apcupsd.in | 34 | ||||
-rw-r--r-- | sysutils/apcupsd/files/apcupsd.sh.sample | 66 |
2 files changed, 34 insertions, 66 deletions
diff --git a/sysutils/apcupsd/files/apcupsd.in b/sysutils/apcupsd/files/apcupsd.in new file mode 100644 index 000000000000..b43442d35168 --- /dev/null +++ b/sysutils/apcupsd/files/apcupsd.in @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: apcupsd +# REQUIRE: SERVERS +# BEFORE: DAEMON +# KEYWORD: shutdown +# +# Add the following line to /etc/rc.conf[.local] to enable apcupsd +# +# apcupsd_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable apcupsd. +# apcupsd_args (str): Custom additional arguments to be passed +# to apcupsd (default empty). +# + +. %%RC_SUBR%% + +name="apcupsd" +rcvar=${name}_enable + +load_rc_config $name + +: ${apcupsd_enable="NO"} +: ${apcupsd_flags="--kill-on-powerfail"} +: ${apcupsd_pidfile="/var/run/apcupsd.pid"} +: ${apcupsd_lockfile"/var/spool/lock/apcupsd.lock"} + +pidfile="/var/run/apcupsd.pid" +required_files="%%PREFIX%%/etc/apcupsd/apcupsd.conf" +command="%%PREFIX%%/sbin/apcupsd" + +run_rc_command "$1" diff --git a/sysutils/apcupsd/files/apcupsd.sh.sample b/sysutils/apcupsd/files/apcupsd.sh.sample deleted file mode 100644 index 567c4a65eb46..000000000000 --- a/sysutils/apcupsd/files/apcupsd.sh.sample +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# $FreeBSD$ -# startup scripts for APCUPSD. - -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -# If there is a global system configuration file, suck it in. -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf - source_rc_confs -elif [ -r /etc/rc.conf ]; then - . /etc/rc.conf -fi - -apcupsd_enable=${apcupsd_enable:-YES} -apcupsd_program=${apcupsd_program:-${PREFIX}/sbin/apcupsd} -apcupsd_flags=${apcupsd_flags:-"--kill-on-powerfail"} -apcupsd_pidfile=${apcupsd_pidfile:-/var/run/apcupsd.pid} -apcupsd_lockfile=${apcupsd_lockfile:-/var/spool/lock/apcupsd.lock} - -case $1 in - start) - case "${apcupsd_enable}" in - [Yy][Ee][Ss]) - rm -f /var/run/powerfail - rm -f /var/run/nologin - if [ -f ${apcupsd_program} ]; then - echo -n " apcupsd" - ${apcupsd_program} ${apcupsd_flags} || return=" Failed." - touch ${apcupsd_lockfile} - fi - ;; - esac - ;; - - stop) - if [ -f ${apcupsd_pidfile} ]; then - PID=`cat ${apcupsd_pidfile}` - kill -KILL $PID || return=" Failed." - rm -f ${apcupsd_pidfile} - # some slaves won't die - killall apcupsd > /dev/null 2>&1 - echo " apcupsd killed" - else - return=" Failed." - fi - ;; - - restart) - $0 stop - $0 start; - ;; - - status) - ${PREFIX}/sbin/apcaccess status - ;; - - *) - echo "usage: $0 {start|stop|restart|status}" 1>&2 - ;; -esac - -exit 0; |