FTP Shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP Shell
# 1  
Old 10-08-2008
Bug FTP Shell

Hi,

I know this topic is on the forum a bit but I am totally new to Unix and I am really struggling and could do with some help.

I need to write a shell script which will ftp a file from my Oracle Apps DB to a remote ftp server.

I undertand about how I can schedule it with a cron job but I just can't get the actual shell to run when I execute it.

Could anyone please put me in the direction of (or post me even) some real basic, step by step procedures of what is needed to create a shell script which will connect and put a file from Unix DB server to remote ftp- I mean really really really basic - I'd massively appreciate it.

Thanks in advance.
# 2  
Old 10-08-2008
Check if this helps..

Code:
#!/bin/sh
HOST='hostname'
USER='yourid'
PASSWD='yourpw'
FILE='file.txt'

ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
put $FILE
quit
END_SCRIPT
exit 0

# 3  
Old 10-08-2008
Hi,

with vi I created the file with the name ftp_test.sh and gave it '775' permissions.

I executed the file by typing sh ftp_test.sh and I received the following:-

ftp_test.sh: line 2: HOST:command not found
ftp_test.sh: line 3: USER:command not found
ftp_test.sh: line 4: PASSWD:command not found
ftp_test.sh: line 5: FILE:command not found
not connected
not connected

Do you think I've typed it wrong or something?
# 4  
Old 10-08-2008
You can do like this as well

echo
(
echo "open $IP"
echo "user $USER $PASSWD"
echo "put $File_name"
echo "verbose"
echo "bye"
) | ftp -inv
# 5  
Old 10-08-2008
Post your script so we can see what the problem might be.
# 6  
Old 10-08-2008
Hi,

worked out what I was doing wrong in the first issue - I was leaving a space where I shouldn't have i.e. HOST = 'hostname' and not HOST='hostname' as it should be. Also, I was getting what I thought was an error message saying KERBEROS_V4 authentication error or something - but it has worked now.

Thank you!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP within a SHELL script

I am running the following on linux (on a mac): filename="/Users/thisfilename.txt" hostname="ftp.mysite.com" username="myusername" password="mypassword" echo '=======FTP========' ftp -un $hostname <<EOF quote USER $username quote PASS $password binary put $filename quit EOF I... (4 Replies)
Discussion started by: globalnerds
4 Replies

2. Shell Programming and Scripting

Help with Shell script for FTP

#!/usr/bin/ksh export filename=/grid/PowerCenter/inbound/AT/filelist.txt export SOURCE_DIR=/grid/PowerCenter/inbound/AT export ICOMS_FTP_TGT_DIR1=/dw/input/ATU/ICOM_SERV1 export ICOMS_FTP_TGT_DIR2=/dw/input/AT/ICOM_SERV2 export FILE_MASK="ATRPU_RP_ATU" echo "start" ftp_data_file() { ... (15 Replies)
Discussion started by: vsmeruga
15 Replies

3. UNIX for Dummies Questions & Answers

FTP shell script

Hi I am new in UNIX field. I don't know if I am posting in right forum or not. And I have also found out that there are so many posts about ftp shell scripting. I have tried those but actually having some problem. Well, my script should do the following..... It finds files( the filename ended... (3 Replies)
Discussion started by: abhishek_510
3 Replies

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

5. Shell Programming and Scripting

good old shell ftp...how!

hi: I am trying to move files from server to server with ftp. I want the command to read a folder and upload all subdirs and files. what is the command to do this? is there something cooler than ftp? if so. how to use it? thanks again. (2 Replies)
Discussion started by: jason7
2 Replies

6. Shell Programming and Scripting

Shell scripting - FTP

Can some one help with script to track ftp logins on AIX server.. (1 Reply)
Discussion started by: ddk2oo5
1 Replies

7. Shell Programming and Scripting

FTP using shell script

Hi All, I want to make a ftp call using a separate file where the ftp commands will reside. Please find below the details: I have 2 files Sample1.sh and Properties Properties --------- <username> <password> .... other ftp commands Sample1.sh ---------- ftp -v <servername> <... (1 Reply)
Discussion started by: pickpeters
1 Replies

8. Shell Programming and Scripting

ftp in shell script

Hi, I have to ftp to a remote machine. i have got the Ip, username and password and the file path.. I need to get the file name with out user intervention in my script.. is there any way to do this.. please help esham (2 Replies)
Discussion started by: esham
2 Replies

9. UNIX for Dummies Questions & Answers

C shell FTP

Does anyone have any examples, similar to the one below that utilize the C shell #! /usr/bin/csh -f I'm already using the C shell for some sleep, loop logic and want to incorportant a ftp process when the loop was sucessful. Now I'm kinda stuck, because the 2 seperate pieces that i wanted to... (0 Replies)
Discussion started by: mmarsh
0 Replies

10. Shell Programming and Scripting

using ftp in a shell script.

I am trying to ftp some files from a certain directory, but i got an invalid command. does anybody know why i got this error? ftp -v -i -n <<SCRIPT open servername user username password cd /server/logs for file in MCWAS* do put ${file} /home/test/${file} done bye SCRIPT (2 Replies)
Discussion started by: caesarkim
2 Replies
Login or Register to Ask a Question