Imported Upstream version 2.4.3
This commit is contained in:
commit
26fb71b504
446 changed files with 148951 additions and 0 deletions
4
scripts/RedHat/README
Normal file
4
scripts/RedHat/README
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Install ups in /etc/rc.d/init.d
|
||||
|
||||
/etc/sysconfig/ups is used only to store the POWERDOWNFLAG variable
|
||||
|
||||
40
scripts/RedHat/halt.patch
Normal file
40
scripts/RedHat/halt.patch
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
--- /etc/rc.d/init.d/halt Thu Mar 28 00:21:19 2002
|
||||
+++ halt.new Fri Jan 31 15:29:49 2003
|
||||
@@ -8,8 +8,17 @@
|
||||
# Modified for RHS Linux by Damien Neil
|
||||
#
|
||||
|
||||
+# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
|
||||
+# Modified ups shutdown for new NUT method
|
||||
+#
|
||||
# Set the path.
|
||||
PATH=/sbin:/bin:/usr/bin:/usr/sbin
|
||||
+# load /etc/sysconfig/ups if present I've put the POWERDOWNFLAG
|
||||
+# in there so noboby have to manually modify the shutdown script
|
||||
+if [ -f /etc/sysconfig/ups ]; then
|
||||
+ . /etc/sysconfig/ups
|
||||
+fi
|
||||
+UPSCMD=`which upsdrvctl`
|
||||
|
||||
export NOLOCALE=1
|
||||
. /etc/init.d/functions
|
||||
@@ -198,10 +208,15 @@
|
||||
fi
|
||||
|
||||
if [ "$command" = halt ] ; then
|
||||
- if [ -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then
|
||||
- . /etc/sysconfig/ups
|
||||
- [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE
|
||||
- fi
|
||||
+# if [ -r /etc/ups/upsmon.conf -a -f /etc/killpower -a -f /etc/sysconfig/ups ] ; then
|
||||
+# . /etc/sysconfig/ups
|
||||
+# [ "$SERVER" = "yes" -a "$MODEL" != "NONE" -a -n "$MODEL" -a -n "$DEVICE" ] && $MODEL -k $DEVICE
|
||||
+# fi
|
||||
+ if [ -n "$POWERDOWNFLAG" -a -n "$UPSCMD" ]; then
|
||||
+ if [ -f $POWERDOWNFLAG ]; then
|
||||
+ $UPSCMD shutdown
|
||||
+ fi
|
||||
+ fi
|
||||
fi
|
||||
|
||||
if [ -x "/sbin/halt.local" ]; then
|
||||
3
scripts/RedHat/ups
Normal file
3
scripts/RedHat/ups
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# POWERDOWNFLAG *must* match that in upsmon.conf
|
||||
POWERDOWNFLAG=/etc/killpower
|
||||
NUTUSER=nutmon
|
||||
110
scripts/RedHat/upsd
Normal file
110
scripts/RedHat/upsd
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# chkconfig: 2345 30 90
|
||||
#
|
||||
# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
|
||||
# Removed all old statements
|
||||
# start programs as user nut
|
||||
# new style starting and stopping upsd
|
||||
# added reload option
|
||||
# use of /etc/sysconfig/ups for POWERDOWNFLAG variable retrieving
|
||||
#
|
||||
# 2002-02-07 Nigel Metheringham <Nigel.Metheringham@InTechnology.co.uk>
|
||||
# made ups.conf pre-eminant, added new upsdrvctl functions, targeted for RH7.2, should
|
||||
# work OK on RH 6.x, 7.x
|
||||
# 2001-10-24 Peter Bieringer <pb@bieringer.de>
|
||||
# enhancements for new style drivers and controls, tested on a RHL 7.1.93 system
|
||||
#
|
||||
# description: NUT upsd and its drivers directly monitor a ups and \
|
||||
# make information from it available to other programs
|
||||
# processname: upsd
|
||||
# config: /etc/ups/upsd.conf
|
||||
# config: /etc/ups/ups.conf
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# POWERDOWNFLAG *must* match that in upsmon.conf
|
||||
# Loading POWERDOWNFLAG from /etc/sysconfig/ups
|
||||
DRIVERPATH=/sbin
|
||||
if [ -f /etc/sysconfig/ups ]; then
|
||||
. /etc/sysconfig/ups
|
||||
else
|
||||
POWERDOWNFLAG=/etc/killpower
|
||||
NUTUSER=nutmon
|
||||
fi
|
||||
UPSDCONF=/etc/ups/upsd.conf
|
||||
UPSCONF=/etc/ups/ups.conf
|
||||
|
||||
# if there are no config file, bail out
|
||||
[ -f $UPSDCONF ] && [ -f $UPSCONF ] || exit 0
|
||||
|
||||
runcmd() {
|
||||
echo -n "$1 "
|
||||
shift
|
||||
if [ "$BOOTUP" = "color" ]; then
|
||||
$* && echo_success || echo_failure
|
||||
else
|
||||
$*
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
# See how we are called.
|
||||
case "$1" in
|
||||
start)
|
||||
# new style drivers uses 'upsdrvctl'
|
||||
echo -n "NUT Starting UPS model drivers: "
|
||||
# starting ase nut user
|
||||
daemon --user $NUTUSER `which upsdrvctl` start
|
||||
echo
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n "NUT Starting UPS daemon: "
|
||||
# starting ase nut user
|
||||
daemon upsd -u $NUTUSER
|
||||
echo
|
||||
touch /var/lock/subsys/upsd
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
# new style upsd stop
|
||||
action "NUT Stopping UPS daemon" \
|
||||
upsd -c stop
|
||||
# new style drivers uses 'upsdrvctl'
|
||||
action "NUT Stopping UPS model drivers" \
|
||||
upsdrvctl stop
|
||||
|
||||
rm -f /var/lock/subsys/upsd
|
||||
;;
|
||||
|
||||
powerdown)
|
||||
# new style drivers
|
||||
runcmd "NUT powerdown of attached UPS(es)" upsdrvctl shutdown
|
||||
;;
|
||||
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
reload)
|
||||
# reloading upsd config files
|
||||
action "NUT Reloading config files" \
|
||||
upsd -c reload
|
||||
;;
|
||||
|
||||
status)
|
||||
# new style drivers
|
||||
action "NUT: checking UPS model drivers" upsdrvctl status
|
||||
|
||||
status upsd
|
||||
;;
|
||||
*)
|
||||
echo "Usage: upsd {start|stop|powerdown|restart|reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
110
scripts/RedHat/upsd.in
Normal file
110
scripts/RedHat/upsd.in
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# chkconfig: 2345 30 90
|
||||
#
|
||||
# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
|
||||
# Removed all old statements
|
||||
# start programs as user nut
|
||||
# new style starting and stopping upsd
|
||||
# added reload option
|
||||
# use of /etc/sysconfig/ups for POWERDOWNFLAG variable retrieving
|
||||
#
|
||||
# 2002-02-07 Nigel Metheringham <Nigel.Metheringham@InTechnology.co.uk>
|
||||
# made ups.conf pre-eminant, added new upsdrvctl functions, targeted for RH7.2, should
|
||||
# work OK on RH 6.x, 7.x
|
||||
# 2001-10-24 Peter Bieringer <pb@bieringer.de>
|
||||
# enhancements for new style drivers and controls, tested on a RHL 7.1.93 system
|
||||
#
|
||||
# description: NUT upsd and its drivers directly monitor a ups and \
|
||||
# make information from it available to other programs
|
||||
# processname: upsd
|
||||
# config: @sysconfdir@/upsd.conf
|
||||
# config: @sysconfdir@/ups.conf
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
# POWERDOWNFLAG *must* match that in upsmon.conf
|
||||
# Loading POWERDOWNFLAG from /etc/sysconfig/ups
|
||||
DRIVERPATH=@DRVPATH@
|
||||
if [ -f /etc/sysconfig/ups ]; then
|
||||
. /etc/sysconfig/ups
|
||||
else
|
||||
POWERDOWNFLAG=/etc/killpower
|
||||
NUTUSER=nutmon
|
||||
fi
|
||||
UPSDCONF=@sysconfdir@/upsd.conf
|
||||
UPSCONF=@sysconfdir@/ups.conf
|
||||
|
||||
# if there are no config file, bail out
|
||||
[ -f $UPSDCONF ] && [ -f $UPSCONF ] || exit 0
|
||||
|
||||
runcmd() {
|
||||
echo -n "$1 "
|
||||
shift
|
||||
if [ "$BOOTUP" = "color" ]; then
|
||||
$* && echo_success || echo_failure
|
||||
else
|
||||
$*
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
# See how we are called.
|
||||
case "$1" in
|
||||
start)
|
||||
# new style drivers uses 'upsdrvctl'
|
||||
echo -n "NUT Starting UPS model drivers: "
|
||||
# starting ase nut user
|
||||
daemon --user $NUTUSER `which upsdrvctl` start
|
||||
echo
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -n "NUT Starting UPS daemon: "
|
||||
# starting ase nut user
|
||||
daemon upsd -u $NUTUSER
|
||||
echo
|
||||
touch /var/lock/subsys/upsd
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
# new style upsd stop
|
||||
action "NUT Stopping UPS daemon" \
|
||||
upsd -c stop
|
||||
# new style drivers uses 'upsdrvctl'
|
||||
action "NUT Stopping UPS model drivers" \
|
||||
upsdrvctl stop
|
||||
|
||||
rm -f /var/lock/subsys/upsd
|
||||
;;
|
||||
|
||||
powerdown)
|
||||
# new style drivers
|
||||
runcmd "NUT powerdown of attached UPS(es)" upsdrvctl shutdown
|
||||
;;
|
||||
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
reload)
|
||||
# reloading upsd config files
|
||||
action "NUT Reloading config files" \
|
||||
upsd -c reload
|
||||
;;
|
||||
|
||||
status)
|
||||
# new style drivers
|
||||
action "NUT: checking UPS model drivers" upsdrvctl status
|
||||
|
||||
status upsd
|
||||
;;
|
||||
*)
|
||||
echo "Usage: upsd {start|stop|powerdown|restart|reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
56
scripts/RedHat/upsmon
Normal file
56
scripts/RedHat/upsmon
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# chkconfig: 2345 31 89
|
||||
#
|
||||
# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
|
||||
# start program as user nut
|
||||
# new style stopping upsmon
|
||||
# added reload option
|
||||
#
|
||||
# description: upsmon talks to upsd and notifies of ups status changes \
|
||||
# also shutting systems down if required.
|
||||
# processname: upsmon
|
||||
# config: /etc/ups/upsmon.conf
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
if [ -f /etc/sysconfig/ups ]; then
|
||||
. /etc/sysconfig/ups
|
||||
else
|
||||
POWERDOWNFLAG=/etc/killpower
|
||||
NUTUSER=nutmon
|
||||
fi
|
||||
|
||||
# See how we are called.
|
||||
case "$1" in
|
||||
start)
|
||||
action "NUT Starting UPS monitor" upsmon -u $NUTUSER
|
||||
touch /var/lock/subsys/upsmon
|
||||
;;
|
||||
stop)
|
||||
action "NUT Stopping UPS monitor: " \
|
||||
upsmon -c stop
|
||||
|
||||
rm -f /var/lock/subsys/upsmon
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
reload)
|
||||
action "NUT Reloading UPS monitor: " \
|
||||
upsmon -c reload
|
||||
|
||||
;;
|
||||
status)
|
||||
status upsmon
|
||||
;;
|
||||
*)
|
||||
echo "Usage: upsmon {start|stop|restart|reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
56
scripts/RedHat/upsmon.in
Normal file
56
scripts/RedHat/upsmon.in
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# chkconfig: 2345 31 89
|
||||
#
|
||||
# 2003-01-31 Antonino Albanese <al.an@monkeysweb.net>
|
||||
# start program as user nut
|
||||
# new style stopping upsmon
|
||||
# added reload option
|
||||
#
|
||||
# description: upsmon talks to upsd and notifies of ups status changes \
|
||||
# also shutting systems down if required.
|
||||
# processname: upsmon
|
||||
# config: @sysconfdir@/upsmon.conf
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
|
||||
# Source function library.
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
if [ -f /etc/sysconfig/ups ]; then
|
||||
. /etc/sysconfig/ups
|
||||
else
|
||||
POWERDOWNFLAG=/etc/killpower
|
||||
NUTUSER=nutmon
|
||||
fi
|
||||
|
||||
# See how we are called.
|
||||
case "$1" in
|
||||
start)
|
||||
action "NUT Starting UPS monitor" upsmon -u $NUTUSER
|
||||
touch /var/lock/subsys/upsmon
|
||||
;;
|
||||
stop)
|
||||
action "NUT Stopping UPS monitor: " \
|
||||
upsmon -c stop
|
||||
|
||||
rm -f /var/lock/subsys/upsmon
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
reload)
|
||||
action "NUT Reloading UPS monitor: " \
|
||||
upsmon -c reload
|
||||
|
||||
;;
|
||||
status)
|
||||
status upsmon
|
||||
;;
|
||||
*)
|
||||
echo "Usage: upsmon {start|stop|restart|reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue