Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Windows server running Windows Server 2008 R2. I've set up an FTP site and a user account and I can connect to it and successfully download files using the Windows command-line FTP client from my machine at home.

I have a NAS running embedded Linux (BusyBox with FFP) and I've set up a cron job to run a script to mirror this FTP site down to the NAS. This script worked a few times but then I noticed that the data on disk wasn't getting updated, so I tried running the script from an SSH session. The output from the mirror command updates the console a couple of times saying "Getting directory contents" and then it errors with:

Unknown command `;'.

The script is as follows

#! /ffp/bin/bash
HOST='xxx.xxx.xxx.xxx'
USER='UserName'
PASS='Password'
TARGETFOLDER='/path/to/local/directory'
SOURCEFOLDER='.'
LOGNAME="$(date +%F-%H-%M-%S).log"
lftp -f "
open $HOST
user $USER $PASS
mirror -P 2 -n --log=$LOGNAME --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"

LFTP is version 4.0.7.

share|improve this question

1 Answer 1

The cause is the proably line break with user and mirror. If ftp client sends "\r\n" without entering any command, this can make issue with server, etc connection termination.

share|improve this answer
    
I've removed the blank line and I still get the same error. –  Greg B Jul 26 '12 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.