scripting for hung ftp in Solaris


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users scripting for hung ftp in Solaris
# 1  
Old 07-07-2005
scripting for hung ftp in Solaris

I am looking for a way to timeout a ftp script in pre Solaris 2.8 (i.e. I cannot use the -T option to ftp).

Does anyone have a way of doing this? I was thinking maybe a subprocess and sleep command?

I tried the search and could not find anything.

Thanks,
Kevin
# 2  
Old 07-08-2005
Found an answer

Nevermind, I found an answer. I do this:

# run ftp as a backgrond process and test the return value
ftp -n $HOST -T $CHILDTIME <<-[]>> $LOG 2>&1 &
user "$USER" "$PASSWORD"
prompt
verbose
bin
cd "$TODIR"
put "$FILE"
quit
[]

# get pid for timeout
ftppid=$!
(
(
sleep $CHILDTIME &
echo $!
wait $! && kill -9 $ftppid
)2>/dev/null &
) | read killerPID

# wait for background process to complete
wait

# kill background process
kill $killerPID
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

FTP scripting issue

I dont have enough bits to post in emergency, but I have an urgent FTP issue. A client of ours wants us to pull files from his server onto our server at which point we can process it. I ask a friend what to do, but I was just give the things to do, not how to do it. I havent written a Unix... (4 Replies)
Discussion started by: MJCreations
4 Replies

2. Solaris

EVA storage HUNG / Solaris issue

Hi, I have a query , is it possible that few LUNs presented to the Solaris OS which are in the unlabeled state can hung EVA frame and cause it to get unresponsive ? please help. thanks. (1 Reply)
Discussion started by: mushtaq
1 Replies

3. Shell Programming and Scripting

Need FTP scripting

Hi, Please can you tell me the script to transfer file from server A to Server B (1 Reply)
Discussion started by: e1994264
1 Replies

4. HP-UX

ssh session getting hung (smilar to hpux telnet session is getting hung after about 15 minutes)

Our network administrators implemented some sort of check to kill idle sessions and now burden is on us to run some sort of keep alive. Client based keep alive doesn't do a very good job. I have same issue with ssh. Does solution 2 provided above apply for ssh sessions also? (1 Reply)
Discussion started by: yoda9691
1 Replies

5. Shell Programming and Scripting

FTP scripting Help

Hi, I'm trying to do an FTP script that will read from a list of files and send only the files in that list. Would this work? Does anyone have anything simpler. ftp -nv <<EOF open server user username password get $(nawk -F_ -f bbb.awk Filelisting.txt) EOF (5 Replies)
Discussion started by: bbbngowc
5 Replies

6. Shell Programming and Scripting

FTP-Shell scripting

Hi Everybody, I have come across a problem while doing FTP using shell scripting. So I request any of you can give some idea of how to go about solving the problem but i request you not to give the solution please. Because i'm a java developer newly into Unix shell progrmming and am very enthu... (1 Reply)
Discussion started by: RSC1985
1 Replies

7. Shell Programming and Scripting

FTP scripting

Hello, I'm sure this is an easy one for you UNIX pros. I would like to create and and automated an FTP process. The script should do this: 1. Log into a remote system 2. change to a specified directory 3. copy local files to the remote system 4. quit ftp 5. wait until the next schedule ... (7 Replies)
Discussion started by: bbbngowc
7 Replies

8. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies

9. Answers to Frequently Asked Questions

Automate FTP / Scripting FTP Transfers

One of our most frequent questions is how to automate ftp transfers. There are several approaches. Since I'm writing this post, we will start with my favorite technique. :) In Automated FTP task I present a simple example of my ksh co-process technique. And note that later in this thread I... (0 Replies)
Discussion started by: Perderabo
0 Replies

10. UNIX for Dummies Questions & Answers

Telnet FTP scripting

Hi quick question from a unix newbie Working on a project to get me using unix, the point of this project is to find a printer on the network check for jobs in the printer if the printer has no jobs do nothing if the printer has jobs then check the status for errors and e-mail the user. This... (2 Replies)
Discussion started by: w33man
2 Replies
Login or Register to Ask a Question