The following virtual counter reads physical counter and sends an email to a user, if the count rate is above some value. Motor positions are included and the scan is interrupted:
if( $method =~ /reset/i)
{
return 1;
}
if( $method =~ /read/i)
{
my $counts = Rc("eh1a_c01");
if( $counts > 100)
{
my $p29 = Spectra::gmup( "oh1_mot29");
my $p25 = Spectra::gmup( "oh1_mot25");
system( " echo \"$counts counts at p29 $p29, p25 $p25 \" | mail -s c01 user.name@desy.de");
$Spectra::SYM{ interrupt_scan} = 1;
return 1;
}
}