Results 1 to 2 of 2
Hi,
I made a shell script with the following piece of code to transfer some files via ftp:
Code:
echo 'before ftp'
ftp -n $FtpHost << EOF
quote USER $FtpUser
...
- 12-28-2009 #1Just Joined!
- Join Date
- Dec 2009
- Posts
- 2
Shell script terminated after ftp transfer
Hi,
I made a shell script with the following piece of code to transfer some files via ftp:
The problem is that the script ends after the "quit" command in FTP, so code after it won't run, like the remove of temporary files. If I remove this "quit" command, the shell understands I'm still parsing commands to FTP, although being after the EOF. I used this echo commands to check which parts of the script are running.Code:echo 'before ftp' ftp -n $FtpHost << EOF quote USER $FtpUser quote PASS $FtpPasswd quote CWD $FtpDir put $FileNameLog put $FileNameSqlTarSum put $FileNameSqlTar put $FileNameWwwTarSum put $FileNameTar quit EOF echo 'before rm' rm $FileNameWwwTar $FileNameWwwTarSum $FileNameSql $FileNameSqlTar $FileNameSqlTarSum $FileNameLog echo 'after rm'
Do somebody have a clue of why is this happening?
Thank you,
Josep Maria
- 12-28-2009 #2Just Joined!
- Join Date
- Dec 2009
- Posts
- 2
Found a workaround to solve it.
There's a problem with the EOF here-doc, it must not be indented. Although, problem persist after removing the space.
Using ncftpput command instead of ftp is much easier, so now the code looks like this:
Code:ncftpput -u $FtpUser -p $FtpPasswd $FtpHost $FtpDir $FileNameWwwTar $FileNameWwwTarSum $FileNameSqlTar $FileNameSqlTarSum rm $FileNameWwwTar $FileNameWwwTarSum $FileNameSql $FileNameSqlTar $FileNameSqlTarSum $FileNameLog


Reply With Quote