Executing scripts in back ground


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Executing scripts in back ground
# 8  
Old 07-17-2008
what I can think of at this moment is to kill the process at the end of your fuctions.. eg
PID=`ps -ef |grep Test | awk '{ print $1 }'`#ensure that PID is in column 1 ($1)
kill -9 ${PID}
# 9  
Old 07-17-2008
Bug

All you have to do is insert "fg" in line after done in Test1.ksh file.
Your script are working in background; bring it into foreground to end.

Code:
#! /bin/ksh

for i in $*
do
#echo "$i"
ksh test2 $i &
done
fg

~/scripts/play % test1 a b c
From Test 1 ==> a
From Test 1 ==> b
From Test 1 ==> c
~/scripts/play %
# 10  
Old 07-18-2008
Hi FunibonE...thanks...that works
# 11  
Old 07-18-2008
hi funibone,
I am getting this error : test1.ksh[12]: fg: job control not enabled , when i added fg in test1.ksh
Also the test2.ksh did not start. Wat to do ??
hemant, can you please expalin how u tested that ??
 
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