check ....am i online
#!/usr/bin/perl
#Checks if entowts is online. If not, start it up
use strict;
use Date::Manip;
use Sys::Hostname;
my $pattern = "entowts.sh";
my $ctr = 0;
open FH, "/bin/ps -eaf /bin/grep \"$pattern\" grep -v \"grep\"";
while (
if (m/$pattern/) {
$ctr++;
}
}
close FH;
if ($ctr != 1) {
# There should always be one entowt
# If it's you are not entowt then logoff now
my $mail = "/usr/bin/mailx";
my $recipient = 'entowts@yahoo.com';
my $hostname = hostname();
open MAIL, "$mail -s \"entowts online: $hostname\" $recipient"; print MAIL "This is automatically generated by entowts script.";
print MAIL "=========\n\n";
print MAIL "INFO: Running d:/ekstrim/ekstrim.sh start\n";
system "d:/entowts/entowts.sh start";
print MAIL "Online process:\n";
open FH, "/bin/ps -eaf /bin/grep \"$pattern\" grep -v \"grep\"";
while (
if (m/$pattern/) {
print MAIL $_;
}
} close FH;
close MAIL;
}
1 Comments:
Just want to say what a great blog you got here!
I've been around for quite a lot of time, but finally decided to show my appreciation of your work!
Thumbs up, and keep it going!
Cheers
Christian, iwspo.net
Post a Comment
<< Home