Using ftp with bash


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using ftp with bash
# 1  
Old 09-13-2010
Question Using ftp with bash

hi everybody, is me again... Smilie Now I'm working with FTP, I decide to copy my backup files inside a remote ftp server, I already install and configure my ftp server, I'm using this code to copy a file from my server to the other pc (the final idea is to copy an entire folder):

Code:
#!/bin/bash
HOST="10.31.20.141"
USER="root"
PASSWD="enuma"

#Directorio local de las copias de seguridad
BACKUP="/home/yordan/backup"

#Directorio remoto donde irán las copias de seguridad
REMOTE="/backup"

cd $BAKCUP

#Copia del archivo y renombrado con la fecha
cp archivo.txt archivo1.txt

echo -e "---- BACKUP $(date +%Y%m%d) ----\n" 

ftp -n -v $HOST << EOT
binary
user $USER $PASSWD
prompt

cd $REMOTE                  
mput archivo1.txt
bye
bye
EOTp_$$.log

When I test this code the console show me all this stuffs:

Code:
Connected to 10.31.20.141.
220 TYPSoft FTP Server 1.10 ready...
500 'AUTH': command not understood.
500 'AUTH': command not understood.
KERBEROS_V4 rejected as an authentication type
530 Please login with USER and PASS.
331 Password required for root.
230 User root logged in.
Interactive mode off.
250 CWD command successful. "/D:/backup/" is current directory.
local: archivo1.txt remote: archivo1.txt
local: archivo1.txt: No such file or directory
221 Goodbye!
[root@elastix yordan]#

But at the end, the file was not copied, so, if someone can help me and tell me what is wrong in this bash code, please teach me, because I'm really lost.

thanks
yordan Smilie

Last edited by pludi; 09-14-2010 at 02:05 AM..
# 2  
Old 09-13-2010
Might be this typo in the script:

BACKUP="/home/yordan/backup"
cd $BAKCUP
# 3  
Old 09-13-2010
ups, ok, let me see... Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ftp with bash, append file where left off

I'm working on a bash script to finish uploading a file. I need a way to get $filesize so that "restart $filesize" will work. Here is my script: ftp -n -v <<END_SCRIPT open ftp.$domain user $user@$domain $password size $file restart $filesize put $file quit END_SCRIPTWayne Sallee... (9 Replies)
Discussion started by: WayneSallee
9 Replies

2. Ubuntu

Bash script for FTP download -Mysql

Hi guys, I recently managed to write up my working script, but now I have a problem. If the file isn't there in the remote server, my actual script jumps it and all ok, but I need something like this: Search file -> if there, then download -> if not, download next file in the list. Any... (7 Replies)
Discussion started by: virtus96
7 Replies

3. UNIX for Dummies Questions & Answers

Bash FTP Script

Hello, I have a bash script used to telnet and transfer files which works great. Trying to FTP to a box that does not support telnet. Been told to use ssh to the user@someIPaddress. I can log in manually but can't seem to make this script work. And help would be appreciated. #!/bin/bash HOST=ssh... (17 Replies)
Discussion started by: jimmyf
17 Replies

4. UNIX for Advanced & Expert Users

FTP Client helps bash + awk

FTP Client helps bash + awk Good afternoon, Dear I have a script that performs a file sent to another server the process is simple but moving large volume of information is run through crontab every 30 minutes, is that the scritp connected to Windows servers, I have unix (solaris 5.10), the... (6 Replies)
Discussion started by: arnolkat
6 Replies

5. Shell Programming and Scripting

Bash script for new file in ftp folder

Hello, I'm trying to make a bash script that send me e-mail if there is any new file in my ftp folder. cat inotify.sh #!/bin/sh /usr/bin/inotifywait -e create \ -mrq /home/mrowcp | while read line; do echo -n "$line " >> /var/log/inotify.log echo `date | cut -d " " -f1-4` >>... (3 Replies)
Discussion started by: mrowcp
3 Replies

6. Shell Programming and Scripting

bash script for ftp-upload is not working

Hello everyone, sorry for the title, most of you must getting sick of reading something like this, but I haven't found a solution, although I found many threads according to it. I'm working on a bash script that connects to a network printer with ftp where I want to upload a pdf created... (3 Replies)
Discussion started by: le_mae
3 Replies

7. Shell Programming and Scripting

FTP script error in BASH

Hi All, I have a script which is supposed to connect to Windows machine and FTP a file into LINUX. Script is like below #!/usr/bin/sh ParamterFle=${1} //grepping all parameters BossFtpLog=${2} // assigning log file ftp -i -n host_name << EOF user1 password1 cd /drive1/drive2 get... (6 Replies)
Discussion started by: Raamc
6 Replies

8. Shell Programming and Scripting

My first FTP bash script - sweet!

Hey - thanks for reading this! I just finished my first bash script that will handle daily ftp downloads for me, but I'm certain it could use some improvement. Its job is to download IDX data from an ftp host (which is 24 hours behind) and I download a mix of *.txt.gz file and .tar files. ... (2 Replies)
Discussion started by: sitesbyjoe
2 Replies

9. Shell Programming and Scripting

simple bash script to ftp?

Hi all has anyone got a code snippet of how i can ftp a file automatically by running a simple bash script. I have 4 things IP address xx.xxx.xx.xx username=satnam domain = app.sample.ftp password= satnam_password Im not sure how to pull these all together to ftp a file? any ideas? (1 Reply)
Discussion started by: satnamx
1 Replies
Login or Register to Ask a Question