Issue with the script

I am trying to run a script which ftp the files from one server to another.

Below is the script -

#!/bin/bash
echo "Please enter no : "
read variable
echo "You entered: $input_variable"
host=xxxxx
USER=xxx
PASSWORD=xxx
ftp -inv $HOST <<EOF
user $USER $PASSWORD
cd /work/path/to/directory/$variable/test/
mput filename.csv
bye
EOF

How ever i am getting the below error -

ftp: connect: Connection refused Not connected. Not connected. Not connected. Not connected. Not connected. Not connected.

Could you please help. I am using SunOS

Are you sure there's an ftp server running at the other end? And no fire wall is getting in the way?

1 Like

how can i check that..thanks for your reply

i can see the ftp server is running at both the end..if i give the below command i get list of users using ftp

ps -ef | grep -i ftp

You should look for a process like ftpd . And make sure, a possible firewall doesn't intercept your traffic.

1 Like