limit the number of jobs to run.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting limit the number of jobs to run.
# 1  
Old 06-15-2007
limit the number of jobs to run.

i just want to get the BackGround status and limit the number of jobs to run the at a time.

can i able get the back ground exit status ? that i code below.

can jobs -l limit the number of jobs to run ?

total is this script looks fine ?


cat run_job.ksh

#!/usr/bin/ksh
####################################
typeset -u SCHEMA_NAME=$1
count=0
cat $home/tablist.list|
while read table
do
sas $table.sas &
count=`expr $count + 1`
echo $count
RC=$?
if (( $RC > 0 )); then
echo " executing the n't succes for $table :$RC "
exit 1
fi
cnt=$(jobs -l | wc -l )
if [[ $cnt -le 5 ]] ; then
continue
else
wait
#echo "In the wait mode"
fi
done
exit 0
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to run multiple cron jobs?

I have two scripts which I'm tying to run one after the other- this is what I've tried: 00 14 * * * /path/one.sh && /path/two.sh I've also tried putting each script on a different line: 00 14 * * * /path/one.sh 00 14 * * * /path/two.sh Can this be done? (1 Reply)
Discussion started by: $shell_Learner
1 Replies

2. Shell Programming and Scripting

Shell script to run multiple jobs and it's dependent jobs

I have multiple jobs and each job dependent on other job. Each Job generates a log and If job completed successfully log file end's with JOB ENDED SUCCESSFULLY message and if it failed then it will end with JOB ENDED with FAILURE. I need an help how to start. Attaching the JOB dependency... (3 Replies)
Discussion started by: santoshkumarkal
3 Replies

3. Shell Programming and Scripting

How to use counter to run the script to limit number?

I want to run my shell script to the limit number.Suppose I know in advance that MAX=5 then I want that my script run 5 times only.Something like below$ vi testingMAX=5COMMAND="ssh -l stpuser VHLDVWSAD001 /projects/st/utils/deploy/deployall.sh >/dev/null 2>&1 &" ; sleep 20;count=0while... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

4. UNIX for Advanced & Expert Users

Run Jobs in Order

Hi All, This might be a silly question and sorry but I didn't know where to start with this. I have a process I need to run 31 times and they must be one after another e.g. Only run after the other has run. It will call a script that I have that runs 3 other processes in order (and... (3 Replies)
Discussion started by: xathras1982
3 Replies

5. UNIX for Advanced & Expert Users

Limit on Number of Cron Jobs Running on one Account

Hello, I have some 150 Cron Jobs running under my UNIX account. I want to add some more jobs. Is there a limit to the number of cron jobs that can be run on an account? Thank you. Pramodini (8 Replies)
Discussion started by: Pramodini Rode
8 Replies

6. Shell Programming and Scripting

specific number jobs run at the same time

Hi, I have more that 100 jobs I can run background, if I want only 4 running at ther same time, how can I write a script to control it? Thanks peter (0 Replies)
Discussion started by: laopi
0 Replies

7. Shell Programming and Scripting

Creating a Schedular to Run the Jobs.

Hi, I have to create a sheduler to run the shell scripts one by one(dependency). Suppose i have 10 scripts. For all the 10 scripts i have a database table containing these scripts_names and status. Executing the first script.if the first status script is only 'success' then go to next... (4 Replies)
Discussion started by: laknar
4 Replies

8. UNIX for Dummies Questions & Answers

Please help me with the run-away cron jobs

I started a cron job on a cluster super computer. I am just a usual user over there and has no root power. The cron job was set by using "crontab -e". It excecutes a perl command every 20 minutes. I could use crontab -l or crontab -r to list or remove the cron job. However, I just found that I... (2 Replies)
Discussion started by: dedema
2 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. Linux

cron jobs not run

hi, I am newbie, I had set cron jobs to update something on one time very day, I had tested the script, it run fine, but the cron jobs seem never run. some help? Thanks. (4 Replies)
Discussion started by: robertsnoog
4 Replies
Login or Register to Ask a Question
atq(1)								   User Commands							    atq(1)

NAME
atq - display the jobs queued to run at specified times SYNOPSIS
atq [-c] [-n] [username...] DESCRIPTION
The atq utility displays the at jobs queued up for the current user. at(1) is a utility that allows users to execute commands at a later date. If invoked by a user with the solaris.jobs.admin authorization, atq will display all jobs in the queue. If no options are given, the jobs are displayed in chronological order of execution. When an authorized user invokes atq without specifying username, the entire queue is displayed; when a username is specified, only those jobs belonging to the named user are displayed. OPTIONS
The following options are supported: -c Displays the queued jobs in the order they were created (that is, the time that the at command was given). -n Displays only the total number of jobs currently in the queue. FILES
/var/spool/cron/atjobs spool area for at jobs. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
at(1), atrm(1), auths(1), cron(1M), auth_attr(4), attributes(5) SunOS 5.10 13 Aug 1999 atq(1)