Multiple hanged FTP processes


 
Thread Tools Search this Thread
Operating Systems Solaris Multiple hanged FTP processes
# 1  
Old 01-09-2012
Multiple hanged FTP processes

Hello people,

I got one problem with a script.

I have a script which runs every five mins and in the script an ftp process is invoked which sends files to a particular location.

The problem is that the ftp process hangs every now and then which causes the whole script to hang.

As the script runs every 5 mins, it invokes an ftp process again and this hanging of ftp process causes the script to be hanged multiple times and in the end a lot of hanged ftp processes and a lot of hanged script processes.

Please someone give me a way so that these ftp process don't get hanged and file transfer is successful without causing the scripts and ftp processes to hang.
# 2  
Old 01-09-2012
Can you show us the script? First we need to check why the ftp query gets stuck. You may want to use -i (disables interactive mode) and -T (sets TTL) switches with the ftp command to avoid getting stuck. But first we need to check the code!
# 3  
Old 01-10-2012
Dear Admin_xor,

Thanks for your response.

following is the ftp part of the script.

Code:
#!/bin/sh
PATTERN=`date +%Y%m%d`
USERNAME=xxx
PASSWORD=xxx
IP=x.x.x.x

ftp -inv $IP << END
quote USER $USERNAME
quote PASS $PASSWORD
asc
cd /files/123Files
lcd /records
mput Files*.unl
lcd /records2
mput Files2*.unl
quit
END

As the script runs every 5 mins, I have observed that when the script does not complete and as 5 mins pass, the script is executed again and another ftp process gets started.

How can I stop such thing to happen?
# 4  
Old 01-10-2012
Better use the FLAGGING mechanism, to avoid dupicate trigger of script.

Code:
#!/bin/sh
PATTERN=`date +%Y%m%d`
USERNAME=xxx
PASSWORD=xxx
IP=x.x.x.x
 
touch ftpProcessing.lck // When script triggered, will create the lck file
 
ftp -inv $IP << END
quote USER $USERNAME
quote PASS $PASSWORD
asc
cd /files/123Files
lcd /records
mput Files*.unl
lcd /records2
mput Files2*.unl
quit
END
 
rm ftpProcessing.lck // remove once ftp process completed

Also make a change in cron file,
Code:
* * * * * ! [ -f ftpProcessing.lck ] && sh <scriptname>

# 5  
Old 01-23-2012
Dear Rksiva,

Thanks for the solution. I will implement and check it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help ps -e on multiple processes

:)Hi there, I am new to scripting and wanted to see if someone can show me how to grep on multiple processes and send the output to a file in /home/mydir/output. I am aware of ps -ef | grep on 1 process but need help looking up multiple processes, can you use this command ps -elf | grep |pid1... (4 Replies)
Discussion started by: abbya
4 Replies

2. Shell Programming and Scripting

kill multiple processes by name

Want to kill multiple processes by name. for the example below, I want to kill all 'proxy-stagerd_copy' processes. I tried this but didn't work: >> ps -ef|grep proxy_copy root 991 986 0 14:45:34 ? 0:04 proxy-stagerd root 1003 991 0 14:45:49 ? 0:01... (2 Replies)
Discussion started by: catalinawinemxr
2 Replies

3. Programming

Capture stdout from multiple processes

I have a number of binaries which I currenlty have no control over. They alright data to stdout. I would like to kick off any number of these binaries and capture and process their stdout. Doing this for one process is straight forward for example - comments and error checking removed for... (6 Replies)
Discussion started by: dvales
6 Replies

4. Programming

Creating Multiple Processes

I am having problems creating multiple forks. I want create a certain number of forks, each call a program and each wait for a different value. How is this accomplished my loop is not doing the trick. for (i = 0; i < 5; i++) { if (fork() < 0) { //print error } ... (3 Replies)
Discussion started by: Vikings1201
3 Replies

5. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

6. Programming

Program to spawn multiple processes

I'm trying to make a program that will spawn multiple child processes then exit. I'm having trouble figuring out how to do this since after I fork, the child process begins running the program again (never ending). int main(void){ for(int i = 0; i < 3; i++){ fork(); }... (1 Reply)
Discussion started by: cagney58
1 Replies

7. UNIX for Dummies Questions & Answers

Running multiple processes in Linux

Hi guys, I want to run the multiple scripts at the same time using a ksh script. For example, I have three scripts to run: a.ksh, b.ksh and c.ksh How to start the above 3 scripts simultaneously and then on the completion of the above scripts I have other tasks to schedule. Thanks Gary (6 Replies)
Discussion started by: abcabc1103
6 Replies

8. Shell Programming and Scripting

multiple processes overlap

Hello I've got a script that creates multiple processes, in ksh, to bcp out 6 tables at a time. In the script, we write messages to the log to show our progress; most of the time, the log messages are nice and neat with one per line, like they should be. But every once in awhile, at random, the... (2 Replies)
Discussion started by: stonemonolith
2 Replies

9. UNIX for Advanced & Expert Users

Crontab spawning multiple at processes

Hi - I need help. My user crontab is spawning multiple at processes (and multiple mencoder program starts, that exit, then restart, repeatedly), locking up my system. For example I have this entry in my crontab: $ sudo crontab -u victoria -e * * * * * ~/recordings/pvr1 * * * * *... (10 Replies)
Discussion started by: gstuart
10 Replies

10. Shell Programming and Scripting

Doubt about multiple processes

Suppose that I am performing some operation on an sql database. Lets say process of Searching and then if a value is found, updating it... Now, when I have some millions of records on which the operation has to be performed... Does it help to spawn multiple processes each executing the same... (9 Replies)
Discussion started by: Legend986
9 Replies
Login or Register to Ask a Question