Taha's picture

So im trying to excute this bash script but it keeps telling me that FTP is an Invalid command is the command not supported?

#!/bin/bash
file="$(date +"%y%m%d")-rtu_workspace.7z"
source="/home/user/rtu_workspace"
backupdir="/home/user/Backup/"
usr="USER"
pw="PWD"
host="10.0.1.251"

find $backupdir -mtime +7 -exec rm {} \;

echo "Creating backup of file $file of $source @ $(date) "
7z a -xr\!*.o -t7z $file $source -mx9

echo "Connecting to FTP server $host"
ftp -n -v -d $host << EOF
user $usr $pw
binary
cd /$usr/
put $file
dir
close
bye
EOF

echo "$file uploaded to $host"
echo "Moving file to backup dir $backupdir"
mv $file $backupdir
echo "End of backup @ $(date)"


I know the script works as i've tested it on a regular ubuntu machine; it its not running within terminal on TKL.

Forum: 
Jeremy Davis's picture

Try SFTP or if that's no good to you you may wish to re-enable FTP. TBH though I'm not sure how you'd go about that.

On second thoughts, as you're trying to connect to a remote FTP from TKL I'm not sure if I'm on the right track. I recall another thread on here where a user was able to connect to TKL via FTP but only from localhost (suggesting that the command works fine). I know TKL will not accept incoming (remote) FTP connections - only SFTP.

Taha's picture

yeah looks to be that ftp isnt supported at all... i didnt really need sftp since its on an internal closed network so i just ended up using the yafc ftp client to do what i wanted.

Add new comment