[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] email to administrator



> Any thoughts?

Only one: a cron job with a script. Something like:

        use DB_File;
        use strict;
        my $admin_email = 'admins@xxxxxxxxxx';
        tie %jobs_seen, "DB_File", "JobsSeen", O_RDWR|O_CREAT, 0666,
$DB_BTREE
                or die "Cannot open persistent hash file 'JobsSeen':
$!\n";
        while(split(/\n/, `condor_q -const 'JobStatus == 5' -f "%d."
ClusterID -f "%d\n" JobID`) {
                my $line = $_;
                chomp $line;
                if ( $line =~ m/(\d+\.\d+)/ ) {
                        if ( ! defined $jobs_seen{$1} ) {
                                &send_email_about_held_job{$1};
                                $jobs_seen{$1} = 1;
                        }
                }
        }
        untie(%jobs_seen);
        exit(0);

Adjust to suit your needs. I'm pretty sure you can figure out why a job
was held as well: whether it was the system or a user who put it on
hold. So you can only send emails about jobs that were held by the
system.

The perisitent hash ensures you only ever send an email once in the
example above. Tweak to suit your needs.

- Ian

Confidentiality Notice.
This message may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution,  or copying  of this message, or any attachments, is strictly prohibited.  If you have received this message in error, please advise the sender by reply e-mail, and delete the message and any attachments.  Thank you.