Commit da6d8fec authored by Chris Lawrence's avatar Chris Lawrence Committed by Didier Raboud

lsb 3.2-14 Debian release.

parent 7d0282b7
lsb (3.2-14) unstable; urgency=low
* Update pidofproc(), status_of_proc() to sync with Ubuntu.
Thanks to Dustin Kirkland. (Closes: #490095)
* Add hooks to init-functions, thanks to Miroslav Jezbera.
These are documented in README.Debian in lsb-base.
(Closes: #490408)
-- Chris Lawrence <lawrencc@debian.org> Mon, 14 Jul 2008 11:30:52 -0500
lsb (3.2-13) unstable; urgency=low
* Include status_of_proc() function from Ubuntu's lsb-base.
......
......@@ -130,4 +130,19 @@ Bourne-style shell permitted by Debian policy (i.e. not just bash).
"Fancy output" can be overriden by setting FANCYTTY=0 in this file.
-- Chris Lawrence <lawrencc@debian.org>, Sat, 26 Aug 2006 21:40:06 -0500
From lsb-base 3.2-14, you can use the following hook functions which
are called by the appropriate functions, instead of supplying your own
logging functions:
log_daemon_msg_pre
log_daemon_msg_post
log_end_msg_pre
log_end_msg_post
log_action_end_msg_post
log_action_end_msg_post
Each function receives all of the arguments sent to the parent
function; the "pre" functions operate before any output, while the
"post" functions operate after the output is produced.
-- Chris Lawrence <lawrencc@debian.org>, Mon, 14 Jul 2008 11:34:48 -0500
......@@ -81,14 +81,17 @@ pidofproc () {
if $(kill -0 "${pid:-}" 2> /dev/null); then
echo "$pid"
return 0
elif ps "${pid:-}" >/dev/null 2>&1; then
echo "$pid"
return 0 # program is running, but not owned by this user
else
return 1 # program is dead and /var/run pid file exists
fi
fi
fi
if [ -x /bin/pidof -a ! "$specified" ]; then
/bin/pidof -o %PPID $1
status="$?"
status="0"
/bin/pidof -o %PPID $1 || status="$?"
if [ "$status" = 1 ]; then
return 3 # program is not running
fi
......@@ -137,7 +140,7 @@ killproc () {
if [ -n "$sig" ]; then
return 0
fi
return 0 # program is not running
return 3 # program is not running
fi
if [ "$status" = 0 -a "$is_term_sig" = yes ]; then
......@@ -148,22 +151,32 @@ killproc () {
# Return LSB status
status_of_proc () {
local daemon name status
local pidfile daemon name status
pidfile=
OPTIND=1
while getopts p: opt ; do
case "$opt" in
p) pidfile="$OPTARG";;
esac
done
shift $(($OPTIND - 1))
if [ -n "$pidfile" ]; then
pidfile="-p $pidfile"
fi
daemon="$1"
name="$2"
status="0"
if [ -x /bin/pidof ]; then
/bin/pidof -o %PPID "$daemon" >/dev/null || status="$?"
if [ "$status" = 0 ]; then
log_success_msg "$name is running."
else
log_failure_msg "$name is not running."
fi
pidofproc $pidfile $daemon >/dev/null || status="$?"
if [ "$status" = 0 ]; then
log_success_msg "$name is running."
return 0
else
log_failure_msg "/bin/pidof not available."
status="1"
log_failure_msg "$name is not running."
return $status
fi
return "$status"
}
log_use_fancy_output () {
......@@ -243,6 +256,7 @@ log_daemon_msg () {
if [ -z "${1:-}" ]; then
return 1
fi
log_daemon_msg_pre "$@"
if [ -z "${2:-}" ]; then
echo -n "$1:"
......@@ -250,6 +264,7 @@ log_daemon_msg () {
fi
echo -n "$1: $2"
log_daemon_msg_post "$@"
}
# #319739
......@@ -281,6 +296,7 @@ log_end_msg () {
if [ -z "${1:-}" ]; then
return 1
fi
log_end_msg_pre "$@"
# Only do the fancy stuff if we have an appropriate terminal
# and if /usr is already mounted
......@@ -299,6 +315,7 @@ log_end_msg () {
echo " failed!"
fi
fi
log_end_msg_post "$@"
return $1
}
......@@ -315,6 +332,7 @@ log_action_cont_msg () {
}
log_action_end_msg () {
log_action_end_msg_pre "$@"
if [ -z "${2:-}" ]; then
end="."
else
......@@ -332,7 +350,16 @@ log_action_end_msg () {
echo "failed${end}"
fi
fi
log_action_end_msg_post "$@"
}
# Hooks for /etc/lsb-base-logging.sh
log_daemon_msg_pre () { :; }
log_daemon_msg_post () { :; }
log_end_msg_pre () { :; }
log_end_msg_post () { :; }
log_action_end_msg_post () { :; }
log_action_end_msg_post () { :; }
FANCYTTY=
[ -e /etc/lsb-base-logging.sh ] && . /etc/lsb-base-logging.sh || true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment