#!/usr/local/bin/perl $|=1; use strict; use File::Basename; use File::Copy; use File::Find; use File::stat; use Getopt::Long; use POSIX qw(strftime); my $pid1; my $pid2; my $pid3; ######################## my @cmd; my $HOME = "/usr/local/SCRIPTS"; if (!defined ($pid1 = fork)) { die "Unable to fork: $!\n"; } elsif (! $pid1) { # this is the branch for the child process my $cmd1 = "$HOME/myscript.sh"; my $out1 = `$cmd1`; exit; } else{ if (!defined ($pid2 = fork)) { die "Unable to fork: $!\n"; } elsif (! $pid2) { # this is the branch for the child process my $cmd2 = "$HOME/myscript.sh"; my $out2 = `$cmd2`; exit; } waitpid($pid1,0); } waitpid($pid2,0); open(LOGFILE,"../LOGS/temp_file_formyscript.txt"); my $flag = 0; my $file1Flag = 0; my $file2Flag = 0; my $logfile1 = ""; my $logfile2 = ""; while() { chomp; if($flag == 0) { $logfile1 = $_; $flag = 1; } if($flag == 1) { $logfile2 = $_; } } open(LOGFILE1,"../LOGS/oldlogs/$logfile1") ; open(LOGFILE2,"../LOGS/oldlogs/$logfile2") ; while() { chomp; if ($_ =~ /Successfully Completed/i) { $file1Flag = 1; } } while() { chomp; if ($_ =~ /Successfully Completed/i) { $file2Flag = 1; } } close LOGFILE; close LOGFILE1; close LOGFILE2; if ( ($file1Flag == 1) and ($file2Flag == 1)) { my $cmd3 = "$HOME/myscript.sh"; my $out3 = `$cmd3`; my $cmd4 = "rm ../LOGS/temp_file_formyscript.txt"; my $out4 = `$cmd4`; # print "inside!!\n"; } else { my $msg = "OPEN_FEED_FAILED\n"; my $cmd5 = "mailx \-s \"OPENFEED\" mypager\@skytel.com \< err_msg.txt "; my $out5 = `$cmd5`; } exit;