Sponsored Content
Top Forums Shell Programming and Scripting automatically check job status Post 302561187 by ahamed101 on Monday 3rd of October 2011 12:02:36 PM
Old 10-03-2011
You can make sure of crontab and a script like this

Code:
#!/bin/bash
#script name : monitor

#the actual job names to be monitored
jobs="job1 job2"
log_path="/tmp"
for j in $jobs
do
  pgrep $j >/dev/null
  if [ $? -ne 0 ]
  then
    grep -i "Error" $log_path/$j >> /tmp/error.log
  fi
done

And crontab entry. The monitor script will run every 10 minutes. For more info man crontab
Code:
*/10 * * * * /tmp/test/monitor

Assuming all the log will be at a common path say /tmp/<job name>.log

--ahamed
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Hw to Know the status of running JoB

Hi all, I am running a job .. and i want to know the status tht it is runnig or not .. and how can i find the jobId of my job .. I have to get it to kill my running job Pls let me know da Unix commands to do it .. i m wrking on Hp UNIX (1 Reply)
Discussion started by: ravi.sadani19
1 Replies

2. 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

3. Shell Programming and Scripting

How to create cron job automatically?

How do I write a perl script to get the cron jobs? I could do a perl -e ' system "crontab -l > jobs.txt " '; Is there a better way? Then I can use perl to make changes to jobs.txt. How can I submit the changes. I suppose I could use system "crontab jobs.txt", is there a better way? ... (0 Replies)
Discussion started by: siegfried
0 Replies

4. Programming

Status of child job after parent is killed

Hi, I have a requirement. Scenario: A parent job invokes a child job and gets killed. The child becomes orphan and gets attached to init. Child job is removed from the pid table as soon as it gets completed. Requirement is i need the status of the child job even after the parent job is... (7 Replies)
Discussion started by: anjul_thegreat
7 Replies

5. Shell Programming and Scripting

check status and run the job

I have one unix job which can be executed using following commands: csh setenv HOME /data/ftpqa/ARTQ/orascripts sudo -u artq /apps/ralocal/bin/runscript artq ../out/art_neg_item_cost_update.csh I want to create one more script, which checks whether art_neg_item_cost_update.csh is already... (1 Reply)
Discussion started by: amarpreetka
1 Replies

6. UNIX for Advanced & Expert Users

Check the status of job

Hi, I have master job which will run based on the sub jobs status. In the master job I am giving the condition like, condition: s(sub_job) f(sub_job) This scenario will work if the sub job status is success or failed. but I want to run my master job even if the sub_job was... (1 Reply)
Discussion started by: Kattoor
1 Replies

7. Shell Programming and Scripting

Get status of dd running in background job

Hello everyone While working on TUI for scripts, there there came the idea to' add a command' for dd too. That was, after 'wrapping' tar and wget either, to display their growing size and return the exit code with a textual-visual-feedback to the user. Now displaying the filesize of a... (13 Replies)
Discussion started by: sea
13 Replies

8. Shell Programming and Scripting

Scheduled job not running automatically in crontab

i have a job scheduled in crontab. The problem is, it is not running automatically as per the time scheduled. But runs when executed manually. What would be the problem? Help me with this please. (6 Replies)
Discussion started by: Santhosh CJ
6 Replies

9. UNIX and Linux Applications

Autosys job not starting automatically

hi I have created autosys job but its not auto starting , also tried job control > start job but doesn't start that way only way it starts is force_startjob. why ? :( thanks (0 Replies)
Discussion started by: user0489
0 Replies

10. Shell Programming and Scripting

To get the job status from second line

I want to get the job status from the second line "SU" to a variable Input: Job Name Last Start Last End ST Run/Ntry Pri/Xit JOBNAME 10/24/2016 10:34:55 10/24/2016 10:44:15 SU 100344/32 0 Code tried JSTATUS=$(cat Input | awk '$6 == "SU" {print $6}')... (5 Replies)
Discussion started by: Joselouis
5 Replies
queuedefs(4)							   File Formats 						      queuedefs(4)

NAME
queuedefs - queue description file for at, batch, and cron SYNOPSIS
/etc/cron.d/queuedefs DESCRIPTION
The queuedefs file describes the characteristics of the queues managed by cron(1M). Each non-comment line in this file describes one queue. The format of the lines are as follows: q.[njobj][nicen][nwaitw] The fields in this line are: q The name of the queue. a is the default queue for jobs started by at(1); b is the default queue for jobs started by batch (see at(1)); c is the default queue for jobs run from a crontab(1) file. njob The maximum number of jobs that can be run simultaneously in that queue; if more than njob jobs are ready to run, only the first njob jobs will be run, and the others will be run as jobs that are currently running terminate. The default value is 100. nice The nice(1) value to give to all jobs in that queue that are not run with a user ID of super-user. The default value is 2. nwait The number of seconds to wait before rescheduling a job that was deferred because more than njob jobs were running in that job's queue, or because the system-wide limit of jobs executing has been reached. The default value is 60. Lines beginning with # are comments, and are ignored. EXAMPLES
Example 1: A sample file. # # a.4j1n b.2j2n90w This file specifies that the a queue, for at jobs, can have up to 4 jobs running simultaneously; those jobs will be run with a nice value of 1. As no nwait value was given, if a job cannot be run because too many other jobs are running cron will wait 60 seconds before trying again to run it. The b queue, for batch(1) jobs, can have up to 2 jobs running simultaneously; those jobs will be run with a nice(1) value of 2. If a job cannot be run because too many other jobs are running, cron(1M) will wait 90 seconds before trying again to run it. All other queues can have up to 100 jobs running simultaneously; they will be run with a nice value of 2, and if a job cannot be run because too many other jobs are running cron will wait 60 seconds before trying again to run it. FILES
/etc/cron.d/queuedefs queue description file for at, batch, and cron. SEE ALSO
at(1), crontab(1), nice(1), cron(1M) SunOS 5.10 1 Mar 1994 queuedefs(4)
All times are GMT -4. The time now is 11:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy