Debian release 2.6.3-2
This commit is contained in:
parent
926c972a29
commit
1aa25b671d
10 changed files with 280 additions and 101 deletions
7
debian/Makefile.am
vendored
7
debian/Makefile.am
vendored
|
@ -2,7 +2,8 @@ EXTRA_DIST = changelog control copyright description.subst hotplug \
|
||||||
nut-cgi.config nut-cgi.docs nut-cgi.examples nut-cgi.postinst nut-cgi.postrm \
|
nut-cgi.config nut-cgi.docs nut-cgi.examples nut-cgi.postinst nut-cgi.postrm \
|
||||||
nut-cgi.preinst nut-cgi.README.Debian nut-cgi.templates nut.config \
|
nut-cgi.preinst nut-cgi.README.Debian nut-cgi.templates nut.config \
|
||||||
nut.default nut.dirs nut.docs nut.examples nut-hal-drivers.docs \
|
nut.default nut.dirs nut.docs nut.examples nut-hal-drivers.docs \
|
||||||
nut.init nut.links nut.postinst nut.postrm nut.preinst nut.prerm \
|
nut-server.init nut-client.init nut-client.links \
|
||||||
nut.README.Debian nut.templates nut.TODO.Debian \
|
nut.postinst nut.postrm nut.preinst nut.prerm nut.README.Debian \
|
||||||
rules watch po/ca.po po/cs.po po/de.po po/fr.po po/POTFILES.in \
|
nut.templates nut.TODO.Debian rules watch \
|
||||||
|
po/ca.po po/cs.po po/de.po po/fr.po po/POTFILES.in \
|
||||||
po/pt.po po/pt_BR.po po/templates.pot po/vi.po
|
po/pt.po po/pt_BR.po po/templates.pot po/vi.po
|
||||||
|
|
15
debian/changelog
vendored
15
debian/changelog
vendored
|
@ -1,3 +1,18 @@
|
||||||
|
nut (2.6.3-2) unstable; urgency=low
|
||||||
|
|
||||||
|
* debian/nut-server.init: rewrite to match upsd / drivers startup scope
|
||||||
|
* debian/nut-client.init: created to match upsmon startup scope
|
||||||
|
(Closes: #634858)
|
||||||
|
* debian/nut.TODO.Debian, debian/Makefile.am: updated to reflect the above
|
||||||
|
* debian/rules: install nut-client.init, and update to reflect the above
|
||||||
|
* debian/control, debian/Makefile.am: updated to reflect the above
|
||||||
|
* debian/nut-client.links: renamed from debian/nut-server.links, since
|
||||||
|
ups-monitor is now provided by nut-client initscript
|
||||||
|
* debian/nut.README.Debian: renamed from nut-server.README.Debian,
|
||||||
|
to provide it with both client and server packages
|
||||||
|
|
||||||
|
-- Arnaud Quette <aquette@debian.org> Tue, 24 Jan 2012 13:14:59 +0100
|
||||||
|
|
||||||
nut (2.6.3-1) unstable; urgency=low
|
nut (2.6.3-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream release (Closes: #635186, #598741, #633756, #638221)
|
* New upstream release (Closes: #635186, #598741, #633756, #638221)
|
||||||
|
|
6
debian/control
vendored
6
debian/control
vendored
|
@ -38,8 +38,8 @@ Package: nut-server
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-client (= ${binary:Version})
|
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lsb-base (>= 3.0-6), ${udev}, nut-client (= ${binary:Version})
|
||||||
Suggests: nut-cgi, nut-snmp, nut-dev, nut-xml
|
Suggests: nut-cgi, nut-snmp, nut-dev, nut-xml
|
||||||
Provides: ups-monitor, nut-usb
|
Provides: nut-usb
|
||||||
Conflicts: ups-monitor, nut-hal-drivers, nut-usb (<< 2.1.0-3), nut-dev (<< 2.2.2)
|
Conflicts: nut-hal-drivers, nut-usb (<< 2.1.0-3), nut-dev (<< 2.2.2)
|
||||||
Replaces: nut (<< 2.6.1-2~)
|
Replaces: nut (<< 2.6.1-2~)
|
||||||
Breaks: nut (<< 2.6.1-2~)
|
Breaks: nut (<< 2.6.1-2~)
|
||||||
Description: network UPS tools - core system
|
Description: network UPS tools - core system
|
||||||
|
@ -56,6 +56,8 @@ Description: network UPS tools - core system
|
||||||
Package: nut-client
|
Package: nut-client
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
|
Provides: ups-monitor
|
||||||
|
Conflicts: ups-monitor, nut-server (<< 2.6.3-1)
|
||||||
Recommends: bash-completion
|
Recommends: bash-completion
|
||||||
Replaces: nut (<< 2.6.1-2~)
|
Replaces: nut (<< 2.6.1-2~)
|
||||||
Breaks: nut (<< 2.6.1-2~)
|
Breaks: nut (<< 2.6.1-2~)
|
||||||
|
|
177
debian/nut-client.init
vendored
Executable file
177
debian/nut-client.init
vendored
Executable file
|
@ -0,0 +1,177 @@
|
||||||
|
#! /bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: nut-client upsmon ups-monitor
|
||||||
|
# Required-Start: $local_fs $syslog $network $remote_fs
|
||||||
|
# Required-Stop: $local_fs $syslog $network $remote_fs
|
||||||
|
# Should-Start: nut-server
|
||||||
|
# Should-Stop: nut-server
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Network UPS Tools monitor initscript
|
||||||
|
# Description: This script take care of starting and stopping the
|
||||||
|
# Network UPS Tools monitoring component (upsmon).
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Author: Arnaud Quette <aquette@debian.org>
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||||
|
|
||||||
|
NAME=nut-client
|
||||||
|
DESC="Network UPS Tools - power device monitor and shutdown controller"
|
||||||
|
CONFIG=/etc/nut/nut.conf
|
||||||
|
pid_dir=/var/run/nut
|
||||||
|
upsmon_pid=${pid_dir}/upsmon.pid
|
||||||
|
upsmon=/sbin/upsmon
|
||||||
|
log=">/dev/null 2>/dev/null"
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
# set upsmon specific options. use "man upsmon" for more info
|
||||||
|
# this parameter is now located in nut.conf, and not in /etc/default/nut anymore
|
||||||
|
# FIXME: retrieved from 'nut' script during update
|
||||||
|
UPSMON_OPTIONS=""
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$upsmon" ] || exit 0
|
||||||
|
|
||||||
|
# Include NUT nut.conf
|
||||||
|
[ -r $CONFIG ] && . $CONFIG
|
||||||
|
|
||||||
|
# FIXME: put all common bits, between nut-client and nut-server,
|
||||||
|
# into a common nut-function
|
||||||
|
|
||||||
|
# Explicitly require the configuration to be done in /etc/nut/nut.conf
|
||||||
|
if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
|
||||||
|
log_action_msg "$NAME disabled, please adjust the configuration to your needs"
|
||||||
|
log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it"
|
||||||
|
# exit success to avoid breaking the install process!
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if /var/run/nut exists and has the correct perms
|
||||||
|
check_var_directory() {
|
||||||
|
[ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \
|
||||||
|
&& chown root:nut ${pid_dir} \
|
||||||
|
&& chmod 770 ${pid_dir}
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if the right components are running
|
||||||
|
check_status() {
|
||||||
|
case "$MODE" in
|
||||||
|
standalone|netserver|netclient)
|
||||||
|
status_of_proc -p $upsmon_pid $upsmon upsmon
|
||||||
|
;;
|
||||||
|
none|*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
start_stop_client () {
|
||||||
|
case "$MODE" in
|
||||||
|
standalone|netserver|netclient)
|
||||||
|
# FIXME: for standalone|netserver, ensure 'nut-server status' returns ?
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start-stop-daemon -S -q -p $upsmon_pid -x $upsmon \
|
||||||
|
-- $UPSMON_OPTIONS >/dev/null 2>&1 &&
|
||||||
|
log_progress_msg "upsmon" || log_progress_msg "(upsmon failed)"
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
start-stop-daemon -K -o -q -p $upsmon_pid -n upsmon >/dev/null 2>&1 &&
|
||||||
|
log_progress_msg "upsmon" || log_progress_msg "(upsmon failed)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
none|*)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
|
||||||
|
start)
|
||||||
|
log_daemon_msg "Starting $DESC"
|
||||||
|
check_var_directory
|
||||||
|
start_stop_client start #&& log_progress_msg "upsmon"
|
||||||
|
log_end_msg 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
log_daemon_msg "Stopping $DESC"
|
||||||
|
start_stop_client stop && log_progress_msg "upsmon"
|
||||||
|
log_end_msg 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
reload)
|
||||||
|
$upsmon -c reload >/dev/null 2>&1
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart|force-reload)
|
||||||
|
# FIXME: lack consistency, due to initscript split.
|
||||||
|
# This only addresses partial reload.
|
||||||
|
# Full reload requires to:
|
||||||
|
# - stop nut-client
|
||||||
|
# - restart (Ie stop+start) nut-server
|
||||||
|
# - start nut-client
|
||||||
|
log_daemon_msg "Restarting $DESC"
|
||||||
|
start_stop_client stop
|
||||||
|
# should then 'start_stop_server stop', Ie /etc/init.d/nut-server stop
|
||||||
|
#sleep 5
|
||||||
|
check_var_directory
|
||||||
|
# should first 'start_stop_server start', Ie /etc/init.d/nut-server start
|
||||||
|
start_stop_client start && log_progress_msg "upsmon"
|
||||||
|
log_end_msg 0
|
||||||
|
;;
|
||||||
|
|
||||||
|
status)
|
||||||
|
#log_daemon_msg "Checking status of $DESC"
|
||||||
|
echo "Checking status of $DESC"
|
||||||
|
check_status
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
|
||||||
|
poweroff)
|
||||||
|
case "$MODE" in
|
||||||
|
standalone|netserver)
|
||||||
|
# Sanity check
|
||||||
|
flag=`sed -ne 's#^ *POWERDOWNFLAG *\(.*\)$#\1#p' /etc/nut/upsmon.conf`
|
||||||
|
if [ -z "$flag" ] ; then
|
||||||
|
log_action_msg "##########################################################"
|
||||||
|
log_action_msg "## POWERDOWNFLAG is not defined in /etc/nut/upsmon.conf ##"
|
||||||
|
log_action_msg "## ##"
|
||||||
|
log_action_msg "## Please read the Manual page upsmon.conf(5) ##"
|
||||||
|
log_action_msg "##########################################################"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Defer to nut-server to actually poweroff the UPS, if needed
|
||||||
|
if $upsmon -K >/dev/null 2>&1 ; then
|
||||||
|
log_daemon_msg "UPS poweroff required..."
|
||||||
|
log_end_msg 0
|
||||||
|
if [ -x /etc/init.d/nut-server ] ; then
|
||||||
|
exec /etc/init.d/nut-server poweroff
|
||||||
|
else
|
||||||
|
log_action_msg "Failure: /etc/init.d/nut-server script missing"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log_action_msg "Power down flag is not set (UPS poweroff not needed)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
none|netclient|*)
|
||||||
|
# nothing to do
|
||||||
|
log_action_msg "'$MODE' configuration does not require UPS poweroff"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
N=/etc/init.d/$NAME
|
||||||
|
echo "Usage: $N {start|stop|reload|restart|force-reload|status|poweroff}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
1
debian/nut-client.links
vendored
Normal file
1
debian/nut-client.links
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
etc/init.d/nut-client etc/init.d/ups-monitor
|
159
debian/nut-server.init
vendored
159
debian/nut-server.init
vendored
|
@ -1,8 +1,8 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
### BEGIN INIT INFO
|
### BEGIN INIT INFO
|
||||||
# Provides: nut
|
# Provides: nut-server upsd
|
||||||
# Required-Start: $local_fs $syslog $network $remote_fs udev
|
# Required-Start: $local_fs $syslog $network $remote_fs udev
|
||||||
# Required-Stop: $local_fs $syslog $network $remote_fs udev
|
# Required-Stop: $local_fs $syslog $network $remote_fs udev nut-client
|
||||||
# Default-Start: 2 3 4 5
|
# Default-Start: 2 3 4 5
|
||||||
# Default-Stop: 0 1 6
|
# Default-Stop: 0 1 6
|
||||||
# Short-Description: Network UPS Tools initscript
|
# Short-Description: Network UPS Tools initscript
|
||||||
|
@ -15,24 +15,32 @@
|
||||||
|
|
||||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||||
|
|
||||||
NAME=nut
|
NAME=nut-server
|
||||||
DESC="Network UPS Tools"
|
DESC="Network UPS Tools - power devices information server and drivers"
|
||||||
CONFIG=/etc/nut/nut.conf
|
CONFIG=/etc/nut/nut.conf
|
||||||
|
pid_dir=/var/run/nut
|
||||||
|
upsd_pid=${pid_dir}/upsd.pid
|
||||||
|
upsd=/sbin/upsd
|
||||||
|
upsdrvctl=/sbin/upsdrvctl
|
||||||
|
log=">/dev/null 2>/dev/null"
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
# set upsd specific options. use "man upsd" for more info
|
# set upsd specific options. use "man upsd" for more info
|
||||||
|
# this parameter is now located in nut.conf, and not in /etc/default/nut anymore
|
||||||
|
# FIXME: retrieved from 'nut' script during update
|
||||||
UPSD_OPTIONS=""
|
UPSD_OPTIONS=""
|
||||||
|
|
||||||
# set upsmon specific options. use "man upsmon" for more info
|
# Exit if the package is not installed
|
||||||
UPSMON_OPTIONS=""
|
[ -x "$upsd" ] || exit 0
|
||||||
|
|
||||||
# Include NUT nut.conf
|
# Include NUT nut.conf
|
||||||
if [ -f $CONFIG ] ; then
|
[ -r $CONFIG ] && . $CONFIG
|
||||||
. $CONFIG
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Explicitly require the configuration to be done in /etc/nut/nut.conf
|
# Explicitly require the configuration to be done in /etc/nut/nut.conf
|
||||||
|
# redundant with nut-client
|
||||||
if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
|
if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
|
||||||
log_action_msg "$NAME disabled, please adjust the configuration to your needs"
|
log_action_msg "$NAME disabled, please adjust the configuration to your needs"
|
||||||
log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it"
|
log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it"
|
||||||
|
@ -40,32 +48,23 @@ if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pid_dir=/var/run/nut
|
|
||||||
upsmon_pid=${pid_dir}/upsmon.pid
|
|
||||||
upsd_pid=${pid_dir}/upsd.pid
|
|
||||||
upsd=/sbin/upsd
|
|
||||||
upsdrvctl=/sbin/upsdrvctl
|
|
||||||
upsmon=/sbin/upsmon
|
|
||||||
log=">/dev/null 2>/dev/null"
|
|
||||||
|
|
||||||
# Check if /var/run/nut exists and has the correct perms
|
# Check if /var/run/nut exists and has the correct perms
|
||||||
check_var_directory() {
|
check_var_directory() {
|
||||||
[ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \
|
[ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \
|
||||||
&& chown root:nut ${pid_dir} \
|
&& chown root:nut ${pid_dir} \
|
||||||
&& chmod 770 ${pid_dir}
|
&& chmod 770 ${pid_dir}
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if the right components are running
|
# check if the right components are running
|
||||||
check_status() {
|
check_status() {
|
||||||
case "$MODE" in
|
case "$MODE" in
|
||||||
standalone|netserver)
|
standalone|netserver)
|
||||||
status_of_proc -p $upsd_pid $upsd upsd
|
status_of_proc -p $upsd_pid $upsd upsd
|
||||||
status_of_proc -p $upsmon_pid $upsmon upsmon
|
# FIXME: need driver(s) status too!
|
||||||
;;
|
;;
|
||||||
netclient)
|
none|netclient|*)
|
||||||
status_of_proc -p $upsmon_pid $upsmon upsmon
|
# defered to nut-client
|
||||||
;;
|
#status_of_proc -p $upsmon_pid $upsmon upsmon
|
||||||
none|*)
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -75,38 +74,25 @@ start_stop_server () {
|
||||||
standalone|netserver)
|
standalone|netserver)
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
# First, start driver(s)
|
||||||
! $upsdrvctl start >/dev/null 2>&1 && \
|
! $upsdrvctl start >/dev/null 2>&1 && \
|
||||||
log_progress_msg "(driver(s) failed)" || log_progress_msg "driver(s)"
|
log_progress_msg "(driver(s) failed)" || log_progress_msg "driver(s)"
|
||||||
start-stop-daemon -S -q -p $upsd_pid -x $upsd \
|
# Then, data server (upsd)
|
||||||
-- $UPSD_OPTIONS >/dev/null 2>&1
|
start-stop-daemon -S -p $upsd_pid -x $upsd \
|
||||||
|
-- $UPSD_OPTIONS >/dev/null 2>&1 &&
|
||||||
|
log_progress_msg "upsd" || log_progress_msg "(upsd failed)"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
start-stop-daemon -K -o -q -p $upsd_pid -n upsd >/dev/null 2>&1
|
# Reverse order for stop
|
||||||
|
start-stop-daemon -K -o -p $upsd_pid -n upsd && #>/dev/null 2>&1 &&
|
||||||
|
log_action_msg "upsd" || log_action_msg "(upsd failed)"
|
||||||
! /sbin/upsdrvctl stop >/dev/null 2>&1 && \
|
! /sbin/upsdrvctl stop >/dev/null 2>&1 && \
|
||||||
log_progress_msg "(driver(s) failed)" || log_progress_msg "driver(s)"
|
log_action_msg "(driver(s) failed)" || log_action_msg "driver(s)"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
none|netclient|*)
|
none|netclient|*)
|
||||||
return 1
|
# now handled by nut-client
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
start_stop_client () {
|
|
||||||
case "$MODE" in
|
|
||||||
standalone|netserver|netclient)
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
start-stop-daemon -S -q -p $upsmon_pid -x $upsmon \
|
|
||||||
-- $UPSMON_OPTIONS >/dev/null 2>&1
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
start-stop-daemon -K -o -q -p $upsmon_pid -n upsmon >/dev/null 2>&1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
none|*)
|
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -117,31 +103,31 @@ case "$1" in
|
||||||
start)
|
start)
|
||||||
log_daemon_msg "Starting $DESC"
|
log_daemon_msg "Starting $DESC"
|
||||||
check_var_directory
|
check_var_directory
|
||||||
start_stop_server start && log_progress_msg "upsd"
|
start_stop_server start #&& log_progress_msg "upsd"
|
||||||
start_stop_client start && log_progress_msg "upsmon"
|
#start_stop_client start && log_progress_msg "upsmon"
|
||||||
log_end_msg 0
|
log_end_msg 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
log_daemon_msg "Stopping $DESC"
|
log_daemon_msg "Stopping $DESC"
|
||||||
start_stop_server stop && log_progress_msg "upsd"
|
start_stop_server stop #&& log_progress_msg "upsd"
|
||||||
start_stop_client stop && log_progress_msg "upsmon"
|
#start_stop_client stop && log_progress_msg "upsmon"
|
||||||
log_end_msg 0
|
log_end_msg 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
reload)
|
reload)
|
||||||
$upsd -c reload >/dev/null 2>&1
|
$upsd -c reload >/dev/null 2>&1
|
||||||
$upsmon -c reload >/dev/null 2>&1
|
#$upsmon -c reload >/dev/null 2>&1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restart|force-reload)
|
restart|force-reload)
|
||||||
log_daemon_msg "Restarting $DESC"
|
log_daemon_msg "Restarting $DESC"
|
||||||
start_stop_client stop
|
#start_stop_client stop
|
||||||
start_stop_server stop
|
start_stop_server stop
|
||||||
sleep 5
|
sleep 5
|
||||||
check_var_directory
|
check_var_directory
|
||||||
start_stop_server start && log_progress_msg "upsd"
|
start_stop_server start #&& log_progress_msg "upsd"
|
||||||
start_stop_client start && log_progress_msg "upsmon"
|
#start_stop_client start && log_progress_msg "upsmon"
|
||||||
log_end_msg 0
|
log_end_msg 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -153,44 +139,37 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
|
|
||||||
poweroff)
|
poweroff)
|
||||||
flag=`sed -ne 's#^ *POWERDOWNFLAG *\(.*\)$#\1#p' /etc/nut/upsmon.conf`
|
|
||||||
wait_delay=`sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' /etc/nut/nut.conf`
|
wait_delay=`sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' /etc/nut/nut.conf`
|
||||||
if [ -f "$flag" ] ; then
|
# UPS poweroff action is actually done here.
|
||||||
if $upsmon -K >/dev/null 2>&1 ; then
|
# But nut-monitor (Ie nut-client) does the check and call nut-server if needed!
|
||||||
log_daemon_msg "Shutting down the UPS ..."
|
# This action MUST NOT be called directly, and thus is not exposed in 'Usage'
|
||||||
sleep 1
|
case "$MODE" in
|
||||||
if $upsdrvctl shutdown ; then
|
standalone|netserver)
|
||||||
sleep 5
|
log_daemon_msg "Shutting down the UPS ..."
|
||||||
log_progress_msg "Waiting for UPS to cut the power"
|
if $upsdrvctl shutdown ; then
|
||||||
log_end_msg 0
|
# FIXME (needed?): sleep 5
|
||||||
else
|
log_progress_msg "Waiting for UPS to cut the power"
|
||||||
log_progress_msg "Shutdown failed."
|
log_end_msg 0
|
||||||
log_progress_msg "Waiting for UPS batteries to run down"
|
else
|
||||||
log_end_msg 0
|
log_progress_msg "Shutdown failed."
|
||||||
fi
|
log_progress_msg "Waiting for UPS batteries to run down"
|
||||||
if [ "$wait_delay" ] ; then
|
log_end_msg 0
|
||||||
log_daemon_msg " (will reboot after $wait_delay) ..."
|
fi
|
||||||
sleep "$wait_delay"
|
if [ -n "$wait_delay" ] ; then
|
||||||
invoke-rc.d reboot stop
|
log_daemon_msg " (will reboot after $wait_delay) ..."
|
||||||
fi
|
sleep "$wait_delay"
|
||||||
else
|
invoke-rc.d reboot stop
|
||||||
log_daemon_msg "Power down flag is not set (UPS shutdown not needed)"
|
fi
|
||||||
fi
|
;;
|
||||||
else
|
none|netclient|*)
|
||||||
if [ -z "$flag" ] ; then
|
# nothing to do
|
||||||
log_daemon_msg "##########################################################"
|
;;
|
||||||
log_progress_msg "## POWERDOWNFLAG is not defined in /etc/nut/upsmon.conf ##"
|
esac
|
||||||
log_progress_msg "## ##"
|
|
||||||
log_progress_msg "## Please read the Manual page upsmon.conf(5) ##"
|
|
||||||
log_progress_msg "##########################################################"
|
|
||||||
log_end_msg 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
N=/etc/init.d/$NAME
|
N=/etc/init.d/$NAME
|
||||||
echo "Usage: $N {start|stop|reload|restart|force-reload|status|poweroff}" >&2
|
echo "Usage: $N {start|stop|reload|restart|force-reload|status}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
1
debian/nut-server.links
vendored
1
debian/nut-server.links
vendored
|
@ -1 +0,0 @@
|
||||||
etc/init.d/nut etc/init.d/ups-monitor
|
|
|
@ -126,9 +126,14 @@ MODE. If you are running in "netclient" MODE, jump directly to section 6.
|
||||||
nut.conf provides all the needed features to replace this file.
|
nut.conf provides all the needed features to replace this file.
|
||||||
|
|
||||||
(8) start the daemon
|
(8) start the daemon
|
||||||
Invoke '/etc/init.d/nut start' to start the daemon(s). Check
|
If you use a "standalone" or "netserver" MODE, invoke:
|
||||||
/var/log/syslog to ensure that upsd, appropriate drivers, and upsmon
|
- '/etc/init.d/nut-server start' to start upsd and appropriate driver(s),
|
||||||
started up correctly.
|
- '/etc/init.d/nut-client start' to start upsmon.
|
||||||
|
|
||||||
|
If you are running in "netclient" MODE, invoke:
|
||||||
|
- '/etc/init.d/nut-client start' to start upsmon.
|
||||||
|
|
||||||
|
Check /var/log/syslog to ensure that daemon(s) started up correctly.
|
||||||
|
|
||||||
|
|
||||||
Additional Notes for Sharing a UPS
|
Additional Notes for Sharing a UPS
|
1
debian/nut.TODO.Debian
vendored
1
debian/nut.TODO.Debian
vendored
|
@ -1,4 +1,3 @@
|
||||||
- split nut-server.init into nut-server.init + nut-client.init (upsmon)
|
|
||||||
- how to distribute the nut-scanner and its library? Ie, a single package,
|
- how to distribute the nut-scanner and its library? Ie, a single package,
|
||||||
or using the nut-{xml,snmp,...} packages.
|
or using the nut-{xml,snmp,...} packages.
|
||||||
this requires libusb (0.1), Net SNMP, FreeIPMi, Avahi, libupsclient and Neon!
|
this requires libusb (0.1), Net SNMP, FreeIPMi, Avahi, libupsclient and Neon!
|
||||||
|
|
3
debian/rules
vendored
3
debian/rules
vendored
|
@ -76,7 +76,8 @@ common-install-indep::
|
||||||
binary-install/nut-monitor::
|
binary-install/nut-monitor::
|
||||||
dh_python2 -pnut-monitor
|
dh_python2 -pnut-monitor
|
||||||
|
|
||||||
DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut -- start 50 2 3 4 5 . stop 50 0 1 6 .
|
DEB_DH_INSTALLINIT_ARGS_nut-server := --init-script=nut-server -- start 50 2 3 4 5 . stop 50 0 1 6 .
|
||||||
|
DEB_DH_INSTALLINIT_ARGS_nut-client := --init-script=nut-client -- start 51 2 3 4 5 . stop 51 0 1 6 .
|
||||||
DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf
|
DEB_DH_COMPRESS_ARGS_nut-doc := -X.pdf
|
||||||
|
|
||||||
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
ifeq (linux,$(DEB_HOST_ARCH_OS))
|
||||||
|
|
Loading…
Reference in a new issue