[Pm-utils] [PATCH 01/17] Display hook exit statuses on the logfile.
Victor Lowther
victor.lowther at gmail.com
Sat Feb 16 12:29:47 PST 2008
This patch series reworks and replaces the previous stabilization patch
series. It takes into account the feedback I have recieved so far in that
series, and provides basic hook error return code reporting.
This also reserves exit code 254 for the hooks to indicate that the hook
was not applicable to the system. We treat this specially because it is
not a failure on the hooks part that it cannot run on that system.
---
pm/functions.in | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/pm/functions.in b/pm/functions.in
index 36559fb..96de94f 100644
--- a/pm/functions.in
+++ b/pm/functions.in
@@ -25,6 +25,7 @@ TEMPORARY_CPUFREQ_GOVERNOR="performance"
LOCKDIR="${PM_UTILS_RUNDIR}/locks"
STORAGEDIR="${PM_UTILS_RUNDIR}/storage"
SLEEP_MODULE="kernel"
+NA=254
# Use c sort order
export LC_COLLATE=C
@@ -112,6 +113,14 @@ command_exists()
return $?
}
+hook_exit_status(){
+ case $1 in
+ 0) echo "success." ;;
+ $NA) echo "not applicable." ;;
+ *) echo "Returned exit code $1." ;;
+ esac
+}
+
run_hooks() {
# $1 = type of hook to find.
# $2 = paramaters to pass to hooks.
@@ -140,6 +149,7 @@ run_hooks() {
IFS="${oifs}"
echo "$(date): running ${hook} $2"
"${hook}" $2
+ hook_exit_status $?
)
done
IFS="${oifs}"
--
1.5.3.8
More information about the Pm-utils
mailing list