Run multiples jobs in background mod


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Run multiples jobs in background mod
# 1  
Old 01-21-2013
Run multiples jobs in background mod

Hi,

I have a problem runnig from script two diferents process in background mod. Is there a limitation to do this?

For example

Code:
echo "Running process one:"
./ProcessOne &
echo "Running process two:"
./ProcessTwo &
echo "The process are runnig. Bye"

The problem is that the execution of ProcessOne crash when starts process of ProcessTwo. Is there any way to do this?

Thanks!!!

NOTE: I need to run ProcessOne and ProcessTwo paralelly in background mod.

Last edited by Xedrox; 01-21-2013 at 04:22 PM..
# 2  
Old 01-21-2013
What do you mean crashed(i.e. messages logged)??

You can also try it like this:
Code:
echo "Running process one:"
nohup ./ProcessOne >> ${log_file} &
echo "Running process two:"
nohup ./ProcessTwo >> ${log_file} &
echo "The process are runnig. Bye"

# 3  
Old 01-21-2013
Same problem. When i say crash, i mean the first process "stop" when the second process is sending to background.

---------- Post updated at 03:57 PM ---------- Previous update was at 03:41 PM ----------

Look this, the complete script:

Code:
echo "Launching first process.."
ProcessOne > /dev/null 2> /dev/null &
jobs -l 
#I need time to the process one do some things, 20 seconds is a good time
echo "Sleeping 20 seconds" 
sleep 20
echo "Launching second process.. "
ProcessTwo /dev/null 2> /dev/null &
jobs -l
echo "Finished."

The processTwo comunicates with processOne. But this is the output console

Code:
Launching first process..
[1] + 536870930  Running                 <command unknown>
Sleeping 20 seconds
Launching second process..
[2] + 268435475  Running                 <command unknown>
[1] - 536870930  Running                 <command unknown>
Finished.

For some reason the processOne doesnt execute well. If i do this with two consoles manually in foreground, the program executes well.

I hope you can help me.

Sorry for my english, is bad.
# 4  
Old 01-21-2013
Quote:
Originally Posted by Xedrox
Same problem. When i say crash, i mean the first process "stop" when the second process is sending to background.
What is the program?

If it's an interactive thing which expects a terminal, it will get frozen when something else takes control of the terminal.
# 5  
Old 01-21-2013
Ok, I see both jobs are running:
Quote:
Launching first process..
[1] + 536870930 Running <command unknown> Sleeping 20 seconds Launching second process..
[2] + 268435475 Running <command unknown>
[1] - 536870930 Running <command unknown>
Finished.
Quote:
The processTwo comunicates with processOne.
How? Examples......

Quote:
For some reason the processOne doesnt execute well.
I don't understand, What exactly do you mean?
Does 'P1' not respond to communication from 'P2'?
# 6  
Old 01-22-2013
Quote:
Originally Posted by spacebar
Ok, I see both jobs are running:How? Examples......

I don't understand, What exactly do you mean?
Does 'P1' not respond to communication from 'P2'?
Exaccly. P1 and P2 are not an interactive program. They comunicates with messages with TCP, but i think it is not the question. The problem is when P2 starts, it say "connection time out" becouse P1 doesnt respond.

I repeat, if i do manually with two terminals, the process P1 and P2 work correctly.
# 7  
Old 01-22-2013
Quote:
Originally Posted by Corona688
What is the program?

If it's an interactive thing which expects a terminal, it will get frozen when something else takes control of the terminal.
Please answer this question.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. AIX

Use of screen in running background jobs and how to use this

Hello, Please advise use of screen in running jobs in nohup background and how to use this Best regards, Vishal (1 Reply)
Discussion started by: Vishal_dba
1 Replies

3. Shell Programming and Scripting

Nohup and background jobs

Hi All, Can someone help me in knowing the exact difference between nohup and &. The definition is quite clear but i only want to know if i run my job using & and in between i hung up my terminal. (10 Replies)
Discussion started by: Uinx_addic
10 Replies

4. Shell Programming and Scripting

Problem with Background Jobs

We had a generic process where the jobs are scheduled to run sequentially and in background. We are noticing the problems with the background jobs. Error Message: /bin/ksh: /home/suren/bin/GenericReportScript.sh: cannot execute The same script is existing in bin and it had enough... (2 Replies)
Discussion started by: sureng
2 Replies

5. Shell Programming and Scripting

How to run same script on multiples servers

Hi All, I have some script that run some commands and send results to my email. I want to run same script on mulitiple servers. How can I do that. I know there is an option "ssh". But I'm not quite sure how to use it in the script. And also. scripts has some parameters like following, if :... (10 Replies)
Discussion started by: s_linux
10 Replies

6. UNIX for Dummies Questions & Answers

Background jobs

If I run a job in the background and logoff. Will the job continue to run or will my processes be killed ? (1 Reply)
Discussion started by: jxh461
1 Replies

7. UNIX for Advanced & Expert Users

Notification from Background jobs

Reposting, as it got lost during the database backup. :( Via a shell script a spawn 3 background jobs namely a, b & c. These will take different times to complete. I want to print a different message on completion of each. How can i find out when each one has completed independently. ... (19 Replies)
Discussion started by: vibhor_agarwali
19 Replies

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

9. Programming

Background jobs

Hi there, I'm quite new to UNIX for programming. I have a script that does this: Shows on screen real-time results taken from phone calls and logs them in a file. However, when I start my script, I want my script to start logging in the file in the background, so I can continue working on... (1 Reply)
Discussion started by: Jeremiorama
1 Replies

10. Shell Programming and Scripting

background jobs

Hi, i have a problem with turning a job into backgrund. When i enter this at the shell: spice -b darlington.cir -r output.raw > screenout.tmp & and then let me show the currently running jobs, i get the following output: + Suspended (tty output) spice -b darlington.cir -r output.raw >... (4 Replies)
Discussion started by: qsi
4 Replies
Login or Register to Ask a Question