Psg amount of running jobs?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Psg amount of running jobs?
# 1  
Old 12-26-2014
Psg amount of running jobs?

Hey,

I have to run a lot of jobs (300) and would like to start at one time only 20 jobs and then after thos jobs are finished the next 20. But how to "ask" for whether the jobs are finished?

actually, my starting scripts looks like that:

Code:
for i in jal_*
do
        cd ./$i/
        outname="b_"$i".job"
        nohup ./$outname &
        cd ..
done

One jobs creates always vier "childs" and I thought of using psg with the name of the folder to pick only the jobs I startet. But how to ask for the amount of still running jobs with psg? Or is there another way of figuring this out?

Hope this wasn't too confused...

Thanks alot,
Ergy
# 2  
Old 12-26-2014
Try something like
Code:
j=0
for i in jal_*
do
  nextjob=${i}/b_${i}.job
  [ -f "nextjob" ] || continue
  nohup "$nextjob" &
  if [ $((j+=1)) -gt 20 ]
  then
    wait
    j=0
  fi
done
wait


Last edited by Scrutinizer; 12-26-2014 at 10:30 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Jobs running in a server

Hi, I need to know the jobs running in a server for all users in linux, crontab -l gives for particular user, how ever I need for all users. I have sudo user access. Thanks (4 Replies)
Discussion started by: nag_sathi
4 Replies

2. Shell Programming and Scripting

Running jobs in parallel

I need to process 50 sqlplus scripts which are listed in a text file. I need to develop a shell script that'll read this file and run these sqlplus scripts. At any point of time, the number of sqlplus scripts running shouldn't exceed 6. If any of the sqlplus scripts completes successfully then... (17 Replies)
Discussion started by: gctex
17 Replies

3. UNIX for Dummies Questions & Answers

at jobs not running

im doing at now <return> touch ~/Desktop/file.txt <ctrl d> and file is never created though it says job 7 at Wed Mar 17 15:15:55 2010 why? (4 Replies)
Discussion started by: glev2005
4 Replies

4. Solaris

cron jobs not running from sudo

Hi, I am logging into sun solaris unix box as asood user.Then sudo su_appssu and scheduled my cron jobs.The user appssu is there In the /etc/cron.d/cron.allow . I do not understand why the jobs are not kicking by cron. Do I need to enter directly as appssu ? Regards Megh (10 Replies)
Discussion started by: megh
10 Replies

5. OS X (Apple)

cron jobs running, but not...

I have a cron job set up to run a script on my Leopard Server every night. The job is set up as root, and when I run the script manually, it runs fine. The problem is that it is not doing anything when it runs at night. In the cron log, it says it ran, but did not output the results to the file it... (3 Replies)
Discussion started by: yodomino6
3 Replies

6. UNIX for Advanced & Expert Users

Seriously, cron jobs not running.

Before I get a million and one suggestions on all the things that could be wrong with my scripts - let me assure everyone that this is not the issue. i have a RH EL ES4 server that stopped running all cron jobs except hourly, daily, weekly. This has affected all users including root. No... (7 Replies)
Discussion started by: bill_k_Lopez
7 Replies

7. UNIX for Dummies Questions & Answers

How to tell which cron jobs are still running?

I have some cron jobs that are taking a might long time. That is because they are screen scrapers and I inserted an extra long pause (10 minutes between screens) to be extra polite and minimize network traffic. I was going to have them run once a day but now I'm thinking once a week. How do I... (2 Replies)
Discussion started by: siegfried
2 Replies

8. UNIX for Dummies Questions & Answers

running cron jobs

I would like to add a job using cron. I have following questions - cron jobs are launched using what login-id e.g. is the script launced using my login-id - In which directory would the cron jobs be launched ? - where do the environment variables required in the script being lauched come... (3 Replies)
Discussion started by: sharanbr
3 Replies

9. Shell Programming and Scripting

running cron jobs

Hi, I'm new to cron and I would like to know if this cron entry looks right. Every monday to friday, at 9:15 AM execute the script called done_att.sh Every monday to friday, at 3:15 PM execute the script called start_att.sh 15 09 * * /u54/jobs/done_att.sh 45 15 * *... (1 Reply)
Discussion started by: ted
1 Replies

10. UNIX for Dummies Questions & Answers

exit unix, but says running jobs

hi, i give a exit to the system, but it says that i have running jobs... so i do a ps and it displays two lines, one is a -ksh and the other is the ps which i am issuing... then i give a who -uH, find my pts.. then do a grep... still the same..... whats wrong.. (6 Replies)
Discussion started by: yls177
6 Replies
Login or Register to Ask a Question