Fix output messages content and format
This commit is contained in:
parent
19bb945c64
commit
f4447a2e78
2 changed files with 14 additions and 9 deletions
14
debian/nut-client.init
vendored
14
debian/nut-client.init
vendored
|
@ -17,7 +17,7 @@
|
|||
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"
|
||||
DESC="NUT - power device monitor and shutdown controller"
|
||||
CONFIG=/etc/nut/nut.conf
|
||||
pid_dir=/var/run/nut
|
||||
upsmon_pid=${pid_dir}/upsmon.pid
|
||||
|
@ -75,8 +75,7 @@ start_stop_client () {
|
|||
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)"
|
||||
-- $UPSMON_OPTIONS >/dev/null 2>&1 && return 0 || return 1
|
||||
;;
|
||||
stop)
|
||||
start-stop-daemon -K -o -q -p $upsmon_pid -n upsmon >/dev/null 2>&1 &&
|
||||
|
@ -95,17 +94,20 @@ case "$1" in
|
|||
start)
|
||||
log_daemon_msg "Starting $DESC"
|
||||
check_var_directory
|
||||
start_stop_client start #&& log_progress_msg "upsmon"
|
||||
start_stop_client start && log_progress_msg "upsmon"
|
||||
|| log_progress_msg "upsmon (failed)"
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC"
|
||||
start_stop_client stop && log_progress_msg "upsmon"
|
||||
|| log_progress_msg "upsmon (failed)"
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
reload)
|
||||
log_daemon_msg "Reloading $DESC"
|
||||
$upsmon -c reload >/dev/null 2>&1
|
||||
;;
|
||||
|
||||
|
@ -117,12 +119,13 @@ case "$1" in
|
|||
# - restart (Ie stop+start) nut-server
|
||||
# - start nut-client
|
||||
log_daemon_msg "Restarting $DESC"
|
||||
start_stop_client stop
|
||||
start_stop_client stop || log_progress_msg "upsmon (failed)"
|
||||
# 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_progress_msg "upsmon (failed)"
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
|
@ -148,6 +151,7 @@ case "$1" in
|
|||
fi
|
||||
|
||||
# Defer to nut-server to actually poweroff the UPS, if needed
|
||||
# (the need is tested here though!)
|
||||
if $upsmon -K >/dev/null 2>&1 ; then
|
||||
log_daemon_msg "UPS poweroff required..."
|
||||
log_end_msg 0
|
||||
|
|
9
debian/nut-server.init
vendored
9
debian/nut-server.init
vendored
|
@ -16,7 +16,7 @@
|
|||
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
NAME=nut-server
|
||||
DESC="Network UPS Tools - power devices information server and drivers"
|
||||
DESC="NUT - power devices information server and drivers"
|
||||
CONFIG=/etc/nut/nut.conf
|
||||
pid_dir=/var/run/nut
|
||||
upsd_pid=${pid_dir}/upsd.pid
|
||||
|
@ -76,18 +76,19 @@ start_stop_server () {
|
|||
start)
|
||||
# First, start driver(s)
|
||||
! $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)."
|
||||
# Then, data server (upsd)
|
||||
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)
|
||||
# FIXME: should stop nut-client first!
|
||||
# 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)"
|
||||
log_progress_msg "upsd" || log_progress_msg "(upsd failed)"
|
||||
! /sbin/upsdrvctl stop >/dev/null 2>&1 && \
|
||||
log_action_msg "(driver(s) failed)" || log_action_msg "driver(s)"
|
||||
log_progress_msg "(driver(s) failed)" || log_progress_msg "driver(s)"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue