FTP in ksh script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP in ksh script
# 8  
Old 01-06-2012
Make sure SCRIPT1 is at the beginning of the line and perfectly matches <<SCRIPT1. If there's any mistake, the here-document may become the entire script.

Your code after the FTP is wrong, too.

Code:
if [ "$?" -eq 0 ]
then
        echo 'successful file transfer'
else
        echo 'Error in ftp'
fi  >> $path/return

# 9  
Old 01-06-2012
MySQL

thank you so much, it really worked. Its with the spaces thats causing the problem at the end SCRIPT1 tag.
# 10  
Old 01-06-2012
Please make sure what when you post your code, you post your real code, all of your real code, word for word, letter for letter, keystroke for keystroke, in code tags!! If I hadn't seen a similar problem recently I'd have never guessed Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Having a hell of atime with KSH -ftp automation

Following this thread: https://www.unix.com/ip-networking/1935-automated-ftp-task.html I have created the following script: #! /bin/ksh HOST=ftp.mywebsite2.com USER=astrocloud PASSWD=8**** exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd... (3 Replies)
Discussion started by: Astrocloud
3 Replies

2. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

3. Shell Programming and Scripting

Problem with embedded FTP command in Ksh - System Cannot find the specified path.

I have the following FTP embedded in a Ksh script on AIX 5.3 ftp -n <<WHATEVER open 10.101.26.218 user hcistats ******* ascii put $thupdatefile put $thcollectfile quit WHATEVER Here is what my script returns: ... (3 Replies)
Discussion started by: troym72
3 Replies

4. 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

5. Shell Programming and Scripting

How do I write a ksh script that will check if all ftp files are received?

I am trying to code a ksh script that will check to see if all 26 incoming ftp files have been received before proceeding to the next function, which is to rename each file. Here is the pseudo-code of what I am trying to do: <<STEP_1>> IF all ALS files have been transmitted then... (2 Replies)
Discussion started by: doug145
2 Replies

6. Shell Programming and Scripting

KSH, FTP running a set number at a time?

At work we have a script that pulls a file from a list of remote sites every 10 min. Currently it only does this ftp one sites at a time and this process takes up to 8 minutes to complete. I want to have this list of 24 sites and be able to run the ftp from up to 2 sites on the list at a time. I... (1 Reply)
Discussion started by: kofs79
1 Replies

7. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

8. Shell Programming and Scripting

KSH n FTP query

Hi, I have this slightly modified FTP code (thanks to this forum) function gather_FTPDate { HOST= USER= PASSWD= exec 4>${TEMP_LOG_FILE} ftp -nv >&4 2>&4 |& echo $? if ] then echo "Unable to connect to FTP server!!!" >> ${LOG_FILE} return 0 fi print -p open... (2 Replies)
Discussion started by: psynaps3
2 Replies

9. Shell Programming and Scripting

KSH Script/FTP (NEWBIE)

I trying to write a ksh script (without the help of the Kermit libraries) which connects to a ftp server and checks if the file "KEI.done" exists. If the file exists it print "files is there" if it doesnt exist it prints "file is not there". (the print statements will later be replaced with code to... (2 Replies)
Discussion started by: mike509123
2 Replies

10. Shell Programming and Scripting

FTP in a KSH script

Hi, I'm writing a script to perform automated ftp's. What I would like to know is if it is possible to examine return codes or trap any error messages from the remote server. eg. if during the ftp session i cd to a different directory on the remote server and the directory does not exist, can... (2 Replies)
Discussion started by: Bab00shka
2 Replies
Login or Register to Ask a Question