#!/bin/bash
#
# This is an example of a script to be put into
# /usr/lib/powersave/scripts/. Its name can then be used as an
# event name in /etc/sysconfig/powersave/events.
# Part of the powersave package.
#
# Stefan Seyfried, 2005
#
# The executable which signals powersaved that this script has
# finished his work and the processing of this event is over.
# The fancy brackets to basically the same as `dirname $0`
SCRIPT_RETURN=${0%/*}/powersaved_script_return
#
# we need this for SCRIPT_RETURN at the end, just in case we mess
# up the parameters (i did this in the debug_events script, it hurts ;-)
NUM=$4
#
########################################################################
# put your own code here ###############################################
########################################################################

echo "i am a custom event script and pollute the syslog." | logger

########################################################################
# this must be called to tell powersaved that processing of this
# event is finished. If your script is totally asynchronous, you
# can call this at the beginning of the script, before your code.
# in this case, powersaved will *not* wait for your script to finish.
# if you do not call this, weird things will happen. Maybe this should
# even be put in a trap so it gets called even on errors...
########################################################################
$SCRIPT_RETURN "$NUM|0|my_custom_event_script finished"
