1833126 Members
3618 Online
110051 Solutions
New Discussion

Background process

 
SOLVED
Go to solution
MAYIANAN
Advisor

Background process

Hi frns,

I am doing some FTP process in background from my script.

The issue i am facing now is my script is getting executed fine but since the FTP process is taking more time to get executed in background my application is not returning back to the prompt.

Is there any way to make my script to complete the execution once the FTP processes got over in background????

2 REPLIES 2
Bill Hassell
Honored Contributor
Solution

Re: Background process

The exact mechanism you are using is not clear but I will assume your script is running ftp in the background but is not watching for it to finish. When you start a background process, always get the PID from the shell variable $! as in:

ftp ... stuff &
FTP_PID=$!

Now you can monitor $! periodically by checking it with ps as in:

ps -fp $FTP_PID

If ps returns with a non-zero return code, then the process no longer exists and is therefore completed.


Bill Hassell, sysadmin
MAYIANAN
Advisor

Re: Background process

Thx