Results 1 to 4 of 4
Good Morning,
I am developing a script for automaticli transfer using FTP, but the script is not working. Here is the script itself:
/usr/sbin# bash -xv ftp.sh
#!/bin/bash
ftp -in ...
- 09-30-2009 #1Just Joined!
- Join Date
- Sep 2009
- Location
- Belo Horizonte, Minas Gerais - Brasil
- Posts
- 6
Unworking FTP transfer script.
Good Morning,
I am developing a script for automaticli transfer using FTP, but the script is not working. Here is the script itself:
/usr/sbin# bash -xv ftp.sh
#!/bin/bash
ftp -in <<EOF
open <SERVER_IP>
user <USER> <PASS>
cd backup
mget *
mdelete *
bye
EOF
+ ftp -in
/usr/sbin#
What can i change in to make it work?
- 09-30-2009 #2Just Joined!
- Join Date
- Sep 2009
- Location
- Belo Horizonte, Minas Gerais - Brasil
- Posts
- 6
Well, studyng a little harder, i've found out tha i was suposed to create a idependentend file with the ftp commands to feed the script. I've createda file named EOF, but i still have errors.
Contento of the "eof" file:
/usr/sbin# cat EOF
open <ip>
user <user> <pass>
cd backup
mget *
mdelete *
bye
Content of the ftp.sh file:
#!/bin/bash
ftp -in <<EOF
#open <ip>
#user <usuario> <senha>
#cd backup
#mget *
#mdelete *
#bye
#EOF
Script exiting screen:
:/usr/sbin# bash -xv ftp.sh
#!/bin/bash
ftp -in <<EOF
#open <ip>
#user <usuario> <senha>
#cd backup
#mget *
#mdelete *
#bye
#EOF
+ ftp -in
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command
?Invalid command
When i copy and paste the commandds in the ftp command, it works just fine.
Anyone knows what could be happening?
- 09-30-2009 #3Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,679
Google is your friend.
There are many existing threads and tutorials on this topic.
- 09-30-2009 #4Just Joined!
- Join Date
- Sep 2009
- Location
- Belo Horizonte, Minas Gerais - Brasil
- Posts
- 6
Solved
SOLVED!!!
#!/bin/bash
ftp -ivn << fim
open <ip>
user <user> <pass>
cd backup
mget *
mdelete *
bye
EOF
fim
It was an error in the component between te chair and the keyboard. Since im wasan't beeing verbose (-v), I could't see the workig FTP. And since the script cleans the backup folder, it was rright to send nothing tom me.


Reply With Quote
