[Pm-utils] Fix 'running hooks output' and add logging hook
Peter Jones
pjones at redhat.com
Tue Nov 14 08:26:53 PST 2006
On Sun, 2006-11-12 at 00:36 +0100, Holger Macht wrote:
> Hi,
>
> I've attached a patch which fixes the output of what hook is currenly
> executed.
Thanks for these!
This one I've applied as:
diff -u -p -r1.29 functions
--- pm/functions 14 Nov 2006 16:00:12 -0000 1.29
+++ pm/functions 14 Nov 2006 16:00:24 -0000
@@ -87,14 +87,14 @@ run_hooks()
let filen--
file="${filea[$filen]}"
if [ -x $file ]; then
- echo "$i"
+ echo "===== $(date): running hook: $file ====="
$file $1
fi
done
else
for file in $files ; do
if [ -x $file ]; then
- echo "$i"
+ echo "===== $(date): running hook: $file ====="
$file $1
fi
done
>
> Additionally, I've attached a new hook that does basic logging like lsmod
> or the current kernel version. Unfortunatelly, if no logfile is set, the
> lsmod output is quite big on the command line. So maybe we should do
> something like 'if [ -n "$PM_LOGFILE ]; then...' for this output. Comments
> appreciated.
Applied as:
diff -N pm/hooks/00logging
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pm/hooks/00logging 14 Nov 2006 16:06:19 -0000
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+case "$1" in
+ hibernate|suspend)
+ [ -n "$PM_LOGFILE" ] || exit 0
+ echo -e "Kernel version: `/bin/uname -a`\n"
+ echo -e "`lsmod`\n"
+ echo -e "`free`\n"
+ ;;
+esac
+
+exit 0
--
Peter
More information about the Pm-utils
mailing list