/usr/share/cricket/util/run-subtree is in cricket 1.0.5-20.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | #!/usr/bin/perl -w
# -*- perl -*-
# Cricket: a configuration, polling and data display wrapper for RRD files
#
# Copyright (C) 1998 Jeff R. Allen and WebTV Networks, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# run a cricket subtree and send any output to the provided email addresses
#
use strict;
use Getopt::Long;
use Net::SMTP;
use Net::DNS;
my $result = "";
my @output = ();
my $doSubtree;
# Define your default email address here if you don't want to use -m
my $doMail = 'smrtg@corp.webtv.net';
# Define your SMTP host here
my $mx = 'smtplocal-2001-2.private.lawson.webtv.net';
$result = GetOptions( "mail|m=s" => \$doMail,
"subtree|s=s" => \$doSubtree,
);
if (!$result) {
die "Error handling options.\n";
}
if (!defined($doSubtree)) {
die "Must provide a subtree to run.\n";
}
@output = `perl c:/crickethome/cricket/collect-subtrees $doSubtree 2>&1`;
if ($#output > 0) {
my $res = Net::DNS::Resolver->new;
# Define nameservers here if you don't have a libresolv (like on
# Windows systems)
#$res->nameservers('127.0.0.1');
my ($eUser, $eDomain) = split(/\@/, $doMail);
my @mx = mx($res, $eDomain);
my $subject = "output from subtree " . $doSubtree;
# Comment the $mx[0]->{'exchange'} line and uncomment the ($mx) line
# if you don't want DNS to figure out the exchanger. It may not be
# able to talk to the DNS-determined relay if you're behind a firewall.
#my $smtp = Net::SMTP->new($mx[0]->{'exchange'});
my $smtp = Net::SMTP->new($mx);
$smtp->mail($doMail);
$smtp->to($doMail);
$smtp->data();
$smtp->datasend("Subject: $subject");
$smtp->datasend(@output);
$smtp->dataend();
$smtp->quit;
}
|