The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Urgent Help: Perl Hash compare jamie123 Shell Programming and Scripting 10 01-04-2008 03:09 AM
Perl script help URGENT??? jaganadh Shell Programming and Scripting 4 12-18-2007 07:05 AM
Script Needed Urgent in shell or PERL!!!!!!!!!!!!!!!!!!!! aajan Shell Programming and Scripting 1 10-24-2007 05:28 AM
Perl: Run perl script in the current process vino Shell Programming and Scripting 10 12-09-2005 10:45 AM
Calling CGI Perl in Shell script [urgent] DeepakXavier Shell Programming and Scripting 0 10-09-2005 02:51 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-14-2007
shellscript22 shellscript22 is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
Smile Urgent help for perl script

I am having the autosys script for the perl as follows

#!/usr/bin/perl
print "Welcome to Autosys Ice Script\n";
print "Please enter the Environment (UAT PRD TRN ST DEV ALL):\n";
$environment = <STDIN>;
chomp($environment);
print "Please enter the Action (ON_ICE OFF_ICE):\n";
$action = <STDIN>;
#$action = "ON_ICE";
chomp($action);



if($environment eq "UAT")
{
$environment_symbol = U;
}
elsif($environment eq "PRD")
{
$environment_symbol = P;
}
elsif($environment eq "TRN")
{
$environment_symbol = T;
}
elsif($environment eq "ST")
{
$environment_symbol = S;
}
elsif($environment eq "DEV")
{
$environment_symbol = D;
}
elsif($environment eq "ALL")
{
$environment_symbol = "";
}
else
{
print "ERROR: Invalid Environment";
die();
}

system("rm autosys_list.txt");
#$command="ps -ef | grep $environment_symbol" ;
$command="autorep -J ALL | grep '^'$environment_symbol | awk '{print \$1}' > autosys_list.txt" ;
system($command);

open(MYINPUTFILE, "<autosys_list.txt");
while(<MYINPUTFILE>)
{
my($line) = $_;
chomp($line);
#print "$line\n";
if($line ne "")
{
if($action eq "ON_ICE")
{
put_job_on_ice($line);
}
elsif($action eq "OFF_ICE")
{
put_job_off_ice($line);
}
else
{
print "ERROR: Invalid Action";
die();
}
}
}

if($action eq "ON_ICE")
{
verify_jobs_on_ice();
}
elsif($action eq "OFF_ICE")
{
verify_jobs_off_ice();
}
else
{
print "ERROR: Invalid Action";
die();
}

sub put_job_on_ice
{
my $job_name = $_[0];
$kill_command="sendevent -E KILLJOB -J ".$job_name;
$ice_command="sendevent -E JOB_ON_ICE -J ".$job_name;
print "kill:".$kill_command."\n";
print "ice:".$ice_command."\n";
system($kill_command);
system($ice_command);
}

sub verify_jobs_on_ice
{
$command="autorep -J ALL | grep '^'$environment_symbol | egrep 'RU|AC'" ;
print "WARNING: The following jobs are still Running: (Make sure nothing is returned after this line)\n";
system($command);
}

sub verify_jobs_off_ice
{
$command="autorep -J ALL | grep '^'$environment_symbol | egrep 'OI'" ;
print "WARNING: The following jobs are still On Ice: (Make sure nothing is returned after this line)\n";
system($command);
}
sub put_job_off_ice
{
my $job_name = $_[0];
$ice_command="sendevent -E JOB_OFF_ICE -J ".$job_name;
print "action:".$ice_command."\n";
system($ice_command);
}


========================================

Note i want to find out that when i run the above script it should show me that the following autosys jobs are ON_ICE or OFF_ICE.

UAP_ADV_AribaReqDelMaint_B
UAP_ADV_BeginDay_B
UAP_ADV_AMDailyMaint_B
UAP_ADV_PMDailyMaint_B
UAP_ADV_LinkedJobs_B


Please help on urgent basis with detailed procedure

Thanks
samir
Closed Thread

Bookmarks

Tags
autosys

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0