Getting Process ID of a ftp command

Dear all

Here is my command in my ksh script:

ftp ${ftpParameter} ${serverName} 2>&1 <${ftpScriptFile} |tee -a $LOG_FILE &
ftpPid=$!
wait

Due to server problem,the server accepts the connection and then do nothing,it makes the above script hang, is it possible to set time out for ftp client?
Besides, ftpPid value is process id of "tee" command but not ftp.
Would you tell me why?

My machine is running AIX 6.1.

It's hanging because it is probaby expecting a username password. Try creating a ~/.netrc file

#.netrc
machine <myhost.com> login <myusersname> password <password>

also

chmod 600 ~/.netrc
1 Like