On 12/18/06, Matthias Hopf <[EMAIL PROTECTED]> wrote:
On Dec 18, 06 15:26:46 +0200, Andre Truter wrote:
/etc/sysconfig/powersave/events: EVENT_GLOBAL_*
You should be able to add a script here. It has the advantage, that it
is always called, no matter how the suspend was triggered (except for by
using the direct kernel interface).
Hmm.. This did not work, or I did something wrong.
I wrote a script based on the
/usr/share/doc/packages/powersave/contrib/example_event_script script
and I placed it in /usr/lib/powersave/scripts
I called it umount_nfs and I made it executable.
Then I changed /etc/sysconfig/powersave/events:EVENT_GLOBAL_SUSPEND2DISK
so that it looks like this:
EVENT_GLOBAL_SUSPEND2DISK="prepare_suspend_to_disk umount_nfs
screen_saver do_suspend_to_disk"
I added my little script to the list, but it does not seem to get
executed. I added logging that should end up in the messages file if
I understand correct, but nothing.
I ran SuSEconfig and restarted powersaved after adding the script, not
sure if it is needed.
Any idea what I am doing wrong?
This is what my script look like:
--<snip>--
#!/bin/bash
# script to unmount all nfs mounts when suspend is called
echo "umount_nfs starts"
$LOGGER "umount_nfs starts"
# # source helper_functions to get $PATH, $SCRIPT_RETURN, EV_ID (among others)
. /usr/lib/powersave/scripts/helper_functions
# Note: this sets a trap on "EXIT", so you must exit the script via the
# (also provided) EXIT function after calling $SCRIPT_RETURN
# If you don't call EXIT, the trap will call $SCRIPT_RETURN with return code 1
#
# find nfs mounts
MOUNTS=`mount -v | grep "type nfs" | grep -v nfsd | awk '{print $3}'`
for MOUNTPOINT in $MOUNTS
do
$LOGGER "Unmount $MOUNTPOINT"
umount -f -l $MOUNTPOINT
if [ $? -ne 0 ]
then
echo "ERROR when unmounting $MOUNTPOINT"
fi
done
$LOGGER "umount_nfs done"
# always call $SCRIPT_RETURN before exiting:
$SCRIPT_RETURN $EV_ID 0 "umount nfs succeeded"
EXIT 0
--<snip>--
Thanks
--
Andre Truter | Software Consultant | Registered Linux user #185282
Jabber: [EMAIL PROTECTED] | http://www.trusoft.co.za
~ A dinosaur is a salamander designed to Mil Spec ~
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]