You are here: User Guide > Using LifeKeeper Linux > Advanced Tasks > Sample Notify Script

Sample Notify Script

This sample script is called when a disk full condition is detected and is responsible for reporting the situation to the system administrator. Administrative intervention is required to correct this condition. The script provides an example for sending email to an administrator. Edit this script, located $LKROOT/events/filesys/diskfull/notify, as needed to enable these notification features.

use Getopt::STD; # use the standard getopt package
BEGIN { require '/etc/default/LifeKeeper.pl'; } # use the LifeKeeper libraries
use LK;

sub parseOptions { #noparams

getopts('C:E:n:m:c:a:P:A:s:i:o:d:');
$id = (split /:/, "$opt_n") [1];
die "$0:resource id not specified\n" unless ($id);
# some data is passed in through the sendevent -d argument (see quickCheck)
@_ = split / /, $opt_d;
$percent = "$_[0]";
$blocksfree = "$_[1]";
$device = "$_[2]";
};

# parse the command line options
parseOptions;

# $id, $percent, $blocksfree, $device are defined at this point

$time = localtime;

#
# you may want to log a message containing this information
#
#LKlog "WARNING: $time:\n";
#LKlog "\tFilesystem \"$device\ "mounted on \ "$id\ "\n";
#LKlog "\tis $percent% full ($blocksfree free blocks). \n";

# you may want to customize this script to send email or call
# some other program in order to notify an administrator
#
# Example:
#'mail -s "$time: WARNING: LifeKeeper protected filesystem $device ($id) is $percent% full ($blocksfree blocks free)" root < /dev/null';

exit 0;

© 2012 SIOS Technology Corp., the industry's leading provider of business continuity solutions, data replication for continuous data protection.