While loop - how to run processes one after another (2nd starts after first completes, and so on)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting While loop - how to run processes one after another (2nd starts after first completes, and so on)
# 15  
Old 02-20-2013
Well, strace does add overhead, so you might look at the strace to see what is exec'd that you could test ps for. It is probably on your terminal even if disconnected from your shell.

If any of the files is per-run and is closed at the end, you might be able to make a named pipe the target and track its life by the cat of the output out of the named pipe. Strace can tell you what is being closed at the end, too.

Calling fuser on files can find user processes, but it is a bit slow.

Last edited by DGPickett; 02-20-2013 at 04:50 PM..
# 16  
Old 02-20-2013
Quote:
00:14 2.1Gb 100.0% Searching, 12.4% matched
That's interesting, how the process has managed to rename itself 'searching'. I wonder if it forks every once in a while to tell ps how much farther it's gotten...
No this is not from the ps output, but certainly from the previous command. The ps list follows, and only has got 10 items.
(BTW the process can change its *ARGV[0] string.)

I have not yet seen an indication that usearch directly spawns processes.
If these are spawned by a service-daemon, the strace won't show anything useful.
What gives
Code:
pstree -A

?
shortly after running a usearch command?

So far, it is possible that the processes trigger a VM bug in the kernel, and the system runs out of memory without any processes causing it.
What gives
Code:
uname -a

?
# 17  
Old 02-21-2013
Well, strace could tell us the exact fault.
# 18  
Old 02-23-2013
Could try this...
Code:
#!/bin/bash

i=1

while [ $i -le 197 ]
do
usearch -usearch_global file.$i -db db.file -strand both -id 0.5 -userout output.$i.tab 
wait $!
i=$[$i+1]
done

# 19  
Old 02-26-2013
How do you get $! without & in the script runnning shell unless usearch is an alias?
This User Gave Thanks to DGPickett For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to write a shell script that starts one, then kills it, then starts another?

This is on a CentOS box, I have two scripts that need to run in order. I want to write a shell script that calls the first script, lets it run and then terminates it after a certain number of hours (that I specify of course), and then calls the second script (they can't run simultaneously) which... (3 Replies)
Discussion started by: btramer
3 Replies

2. Homework & Coursework Questions

When I run the script, the cursor starts on the wrong line?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: It's a shell script using a looping logic, trap, tput, if, while. Most of the scripts in this book aren't written... (2 Replies)
Discussion started by: ckleinholz
2 Replies

3. Shell Programming and Scripting

Array Variable being Assigned Values in Loop, But Gone when Loop Completes???

Hello All, Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....? I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies

4. UNIX for Dummies Questions & Answers

Maximum no of processes that can run

Is there any limit in UNIX that only a MAXIMUM no of processes can run at a time? If so, it exceeds then what would be the error we would receive? (4 Replies)
Discussion started by: jansat
4 Replies

5. UNIX and Linux Applications

how to run more than two processes parallely

I would like to call a function called CIRCLE which is further beind called by other function but in a loop that CIRCLE fuction is being called. And this CIRCLE function starts another process which takes 3 hours to complete again, if i put that process in nohup &, I can go to the next command... (2 Replies)
Discussion started by: venugopalsmartb
2 Replies

6. UNIX for Dummies Questions & Answers

Two questions. First one; What are the ways in which a program starts to run.

This is my first post here so hello everyone! I know that a command of the programs name can start a program and clicking on a icon in GUI can as well as a startup shell script but how do I educate myself of the method that starts an application? Does the GUI run a script? What are the ways/ way... (2 Replies)
Discussion started by: theKbStockpiler
2 Replies

7. UNIX for Dummies Questions & Answers

how can I run something as root (modprobe, to be exact) every time computer starts.

I have the root password for my box, but I'm ignorant. So, every time I start my computer, I have to run this command /sbin/modprobe fuse as su, so that I can do other stuff (like mount remote directories locally using sshfs) I guess there's some file, like .bashrc, only it's applicable... (4 Replies)
Discussion started by: tphyahoo
4 Replies

8. UNIX for Advanced & Expert Users

script to run different shells which run different processes

Hi, Would like to ask the experts if anyone knows how to run a script like this: dtterm -title shell1 run process1 on shell1 dtterm -title shell2 run process2 on shell2 cheers! p/s: sorry if i used the wrong forum, quite concussed after watching world cup for several nights; but I... (2 Replies)
Discussion started by: mochi
2 Replies

9. UNIX for Advanced & Expert Users

Run away processes

Hi, My server runnning on SUN Solaris rel.5.5.1. I have been facing this issues for years. I have some Xbase databases running on the server. User is using emulation software to telnet to server for accessing application. If user logout application abnormally - by closing windows session, then... (2 Replies)
Discussion started by: lowtaiwah
2 Replies

10. Shell Programming and Scripting

How to run processes in parallel?

In a korn shell script, how can I run several processes in parallel at the same time? For example, I have 3 processes say p1, p2, p3 if I call them as p1.ksh p2.ksh p3.ksh they will run after one process finishes. But I want to run them in parallel and want to display "Process p1... (3 Replies)
Discussion started by: sbasak
3 Replies
Login or Register to Ask a Question