![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 |
![]() |
| Bookmarks |
| Tags |
| autosys |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|