Hello All,
I have done some research on this and I need to see if I can get some more information. I have a program that checking a second computer to see if it still online. If the second computer is not online then I need it to run a perl script on a server. What is the best way to do this? I have posted my code below, but not sure if that will help.

The Sub "Late File" is where I would want to kick off the script. I have idenfitied the second script as $backup_report and that is what I would like to have run. Any assistance is greatly appreciated.

Portree
use strict; use warnings; use win32::ole; use Date::Calc; use Mime::Lite; my @modify; my $modify_seconds; my $sleep_count = 0; my $final_time; my $a_final_denis = '//10./Automated Reports/Final_Denis_Test.pl'; my $backup_report = '//163./planning/Logistics/Programs/Chicago WIP Qu +ery Tools/Final_Denis_Test.pl'; &checkfile ($a_final_denis); sub checkfile { my $file = shift(@_); my $flag = 1; my $sleep_count = 0; while ($flag){ if (-e $file) { @modify = stat ($file); $modify_seconds = $modify[8]; print "$file\n"; if (&checktime ($modify_seconds, $file)) { $flag = 0; } else { $sleep_count++; if ($sleep_count > 3) {&late_file} sleep(3); } } else { print "File not found\n"; goto F_End; } } } sub checktime { my $modify_seconds = shift(@_); my $file = shift(@_); my $local_time = localtime($modify_seconds); my $current_tm = time(); $final_time = $current_tm - $modify_seconds; print "$final_time\n"; if ($final_time >= 80000) { return 0; }else { goto Q_End; } } sub late_file { open $backup_report; print "File Is Late In Updating"; exit 1; } ########################################### F_End: open $backup_report; my $msg_end = MIME::Lite->new( From =>'rzcj60@freescale.com', #who is sending the email To =>'rzcj60@freescale.com', # who is receiving the email Subject =>'Final Denis Report Innactive', # subject of the ema +il Type =>'multipart/mixed' #what type of email (it is like t +his since it is text and attachment) ); $msg_end->attach(Type =>'TEXT/Plain', #what is being atta +ched Data =>"Computer running Final_Denis automated re +port is not active" #The body of the email ); MIME::Lite->send('smtp', "freescale.net", Timeout=>60); #smtp r +outing information for email $msg_end->send; # send function exit; Q_End: print "File Updated"; exit;

In reply to Backticks and Sub Programs by Portree

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.