Need help to check the jobs status


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help to check the jobs status
# 1  
Old 09-14-2010
Need help to check the jobs status

Hello All,

I'm new in shell scripting and would like to write an automated script that will check few jobs for the completion, and restart the process based on the jobs status. I am not quite sure how do I check the job status... Can someone please help? Any help will be appreciated. Thanks in advance!

-- I call the job names are pre_* & post_*, the script will check post jobs should have completed after the pre job going by timestamp.

example: following are the jobs that I need to check... before
ls -ltr p*
pre_1*
post_2*
pre_3*
pre_4*
pre_5*
pre_6*
pre_7*
pre_8*
post_1*
post_2*
post_3*
post_4*
post_5*
post_6



---------- Post updated at 11:57 AM ---------- Previous update was at 09:39 AM ----------

Quote:
Originally Posted by mohullah
Hello All,

I'm new in shell scripting and would like to write an automated script that will check few jobs for the completion, and restart the process based on the jobs status. I am not quite sure how do I check the job status... Can someone please help? Any help will be appreciated. Thanks in advance!

-- I call the job names are pre_* & post_*, the script will check post jobs should have completed after the pre job going by timestamp.

example: following are the jobs that I need to check... before
ls -ltr p*
pre_1*
post_2*
pre_3*
pre_4*
pre_5*
pre_6*
pre_7*
pre_8*
post_1*
post_2*
post_3*
post_4*
post_5*
post_6
ok following command shows me the the name, time stamps they completed...now I need to check if the files are from previous business day... how do i check?
ls -ltr p* | awk '{print $6,$7, $8, $9}'
output:
Sep 10 14:18 pre_*
Sep 13 10:55 pre_*
Sep 13 10:55 pre_*
Sep 13 14:59 post_*
Sep 13 15:00 post_*
# 2  
Old 09-14-2010
Need GNU date.

Code:
TODAY=$(date +%a)

case "$TODAY" in
Mon) d=-3 ;;
Sun) d=-2 ;;
*) d=-1 ;;
esac

Pre_Business_Day=$(date -d " $d days " +"%h %d")

ls -ltr p* | awk -v s="$Pre_Business_Day" '$6 FS $7==s {print $6,$7, $8, $9}'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX script to check multiple jobs runninng status

Hi Folks, Please help me ,I need a unix shell script to check for multiple jobs running. if there are multiple backup Jobs running then it should be trigger an email . Thanks, Anand T (1 Reply)
Discussion started by: nandu67
1 Replies

2. Shell Programming and Scripting

Check HD status

I have some server ( IBM , Dell ) , our data center is not in the same location with office , therefore , I do not know if the HD lamp is flash when the HD is fault , can advise if I can write a script to check if the HD is normal running or not ? thanks (1 Reply)
Discussion started by: ust
1 Replies

3. AIX

check the status of ypbind

hello , How do i to check the status of ypbind on AIX(5.3) platform ? Thanks AVK Linux (1 Reply)
Discussion started by: avklinux
1 Replies

4. UNIX for Dummies Questions & Answers

How to list the Autosys jobs thats in failure status using Shell Script

Hello There, I am pretty much new to Shell Scripting and also to AutoSys. I would like to know how to list the Autosys jobs in FA status using shell scripting. I would like to get an email alert as and when any Autosys job fails. Also, it should give the path of the Log file. Could you please... (5 Replies)
Discussion started by: supragna
5 Replies

5. Shell Programming and Scripting

1 script or multiple scripts?? - check files, run jobs

Question for anyone that might be able to help: My objective is to eheck if a file (a source file) exists in a directory. If it does then, I'd like to call an application (Informatica ETL file...not necessary to know) to run a program which extracts data and loads it into multiple targets. ... (6 Replies)
Discussion started by: jnanasakti
6 Replies

6. Shell Programming and Scripting

How to list the Autosys jobs thats in failure status using Shell Script

hello There, I am pretty much new to Shell Scripting and also to AutoSys. I would like to know how to list the Autosys jobs in FA status using shell scripting. I would like to get an email alert as and when any Autosys job fails. Also, it should give the path of the Log file. Could you please... (0 Replies)
Discussion started by: supragna
0 Replies

7. Solaris

where to check scheduled jobs in SunOS

Hi SunOS Experts where will look up to correct the problem with my sunos, it normally shutdown on its own and reboot itself. i am suspecting that somebody has scheduled it to be doing like that . which file can i look up to correct this problem.this is a server that is suppose to be up 24/7.... (2 Replies)
Discussion started by: dba
2 Replies

8. UNIX for Dummies Questions & Answers

Searching Status for 2 Autosys jobs

I need to search for a failed status of 2 autosys jobs which write to the same logfile. Is there any way to do that on one line? I already know the following doesn't work, but is there a way to get it to work, or will I have to do a loop? RUN_STATUS=autorep -J jobname jobname if then ... (1 Reply)
Discussion started by: tekster757
1 Replies

9. Shell Programming and Scripting

background jobs exit status and limit the number of jobs to run

i need to execute 5 jobs at a time in background and need to get the exit status of all the jobs i wrote small script below , i'm not sure this is right way to do it.any ideas please help. $cat run_job.ksh #!/usr/bin/ksh #################################### typeset -u SCHEMA_NAME=$1 ... (1 Reply)
Discussion started by: GrepMe
1 Replies

10. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies
Login or Register to Ask a Question