Executing scripts in back ground


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Executing scripts in back ground
# 1  
Old 07-17-2008
Executing scripts in back ground

Hi,

Test1.ksh
#! /bin/ksh
for i in $*
do
#echo "$i"
ksh test2.ksh $i &
done


test2.ksh
#! /bin/ksh
sleep 5s
echo "From Test 1 ==> $1"
exit 0;


I am executing as follows:
ksh test1.ksh a b c

Output is:
From Test 1 ==> a
From Test 1 ==> c
From Test 1 ==> b

After printing the last line its expecting the user to press the enter key to exit. Else its not quitting. How to quit that automatically ??

thanks in advance
# 2  
Old 07-17-2008
use exit 1; at your functions' ends
# 3  
Old 07-17-2008
Tired that too... Its not working .. It is expecting the user to press the enter key to exit back to the shell prompt.....
# 4  
Old 07-17-2008
exit 0 <- will only work if error is encountered
# 5  
Old 07-17-2008
Even without eixt its not working..
# 6  
Old 07-17-2008
Hammer & Screwdriver

One thing you can do is this:

ksh test2.ksh $i > <filename> &

Re-direct your output to some other filename will solve the problem you mentioned but I don't know if this works for you..

cheers
# 7  
Old 07-17-2008
hi hemnath

thanks .. thats working ..

is there any other solution .. coz i may have a requirement like output should be displayed on the screen .. In that case your solution will not work ..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to run a script in back ground within a script

Hi friends, i have two scripts(call it bg1.ksh and bg2.ksh) which needs to be run parallely on background from a script(call it test1.ksh).then i have to wait till these two back ground job gets finished. and once it is completed , then i have to trigger one more script(call it... (4 Replies)
Discussion started by: neelmani
4 Replies

2. Shell Programming and Scripting

prevent multiple tail in back ground

Dears i have a scrip run in unix that need to use the tail -f command, as below: DATE=`date '+%m%d%y'` tail -f /var/messages | grep "start" >> /export/logs/start_${DATE}.out but the problem that the tail -f will be stop and working in the background in then end of the day (23:59:59)... (0 Replies)
Discussion started by: thehero
0 Replies

3. Shell Programming and Scripting

Requesting full back up scripts

hi guys linux noob here wanting to learn linux scripting, i need help with a backup script that not only allows me to back up my files but restore them to my own personal directory, had a look at some of the coding from the scripts section on this site but still lost. any help is much appreciated (8 Replies)
Discussion started by: burnie35
8 Replies

4. AIX

Help with back ground scripts...

I have a user that runs a menu driven application, is there a way to see what scripts this application is executing in the back ground? OS=AIX 4.3 (1 Reply)
Discussion started by: mangolinux
1 Replies

5. Solaris

Back up scripts

Hi Everyone, I would like to write a Back-up script for huge files and 3 day old file. I think i need to use Tar command for it. But I am not sure how this can be done. Can someone please assist me on this. (4 Replies)
Discussion started by: gehlnar
4 Replies

6. Shell Programming and Scripting

Run script in back ground

I have a script "a" running in background. From script "a" i will kick off script "b" which will also be in background. Is this possible. And actually what i want is, In script "b" when i do ps -ef, script "a" should not be seen. Current "a" script ---- --- ---- nohup b exit current... (1 Reply)
Discussion started by: vasuarjula
1 Replies

7. Shell Programming and Scripting

Executing scripts in Parallel

Hi All, I have 3 shell scripts, Script1,Script2 and Script3. Now I want to run Script1 and Script2 in parallel and Script3 should depend on successful completion of both Script1 and Script2. Could you please suggest an approach of acheiving this... Thanks in advance (2 Replies)
Discussion started by: itsme_maverick
2 Replies

8. UNIX for Advanced & Expert Users

executing perl scripts

Does anybody experiencing this same problem? I am using IRIX64 ver 6.5 at work. I wrote some Perl scripts and to execute it. First I try to put the Perl script at: /$HOME/bin/perlscript then I set the correct executable 755 right to the file I make sure the PATH to the executable... (2 Replies)
Discussion started by: vtran4270
2 Replies
Login or Register to Ask a Question