mv -f /tmp/srg.fw /tmp/srg.fw.old 
ftp -p -n $1 &> /tmp/srgfwftplog <<FTP_END_SCRIPT
quote USER NT_SRG501 
quote PASS NT_SRG501
binary
get $2 /tmp/srg.fw
quit
FTP_END_SCRIPT
echo 0 > /tmp/srgfwftpstatus
cat /tmp/srgfwftplog | grep "[Cc]onnection [Rr]efused"
if [ $? -eq 0 ]; then
  echo 101 Connection Refused > /tmp/srgfwftpstatus
  echo end > /tmp/srgfwftplog
fi
cat /tmp/srgfwftplog | grep "[Ll]ogin [Ii]ncorrect"
if [ $? -eq 0 ]; then
  echo 102 Login Incorrect > /tmp/srgfwftpstatus
  echo end > /tmp/srgfwftplog
fi  
cat /tmp/srgfwftplog | grep "[Nn]o such file"
if [ $? -eq 0 ]; then
  echo 103 No such file > /tmp/srgfwftpstatus
  echo end > /tmp/srgfwftplog
fi
cat /tmp/srgfwftplog | grep "[Nn]ot [Cc]onnected"
if [ $? -eq 0 ]; then
  echo 104 Not Connected > /tmp/srgfwftpstatus
  echo end > /tmp/srgfwftplog
fi
test -a /tmp/srg.fw
if [ $? -eq 0 ]; then
  echo 200 File Transfer Ok > /tmp/srgfwftpstatus
else 
  echo 301 File Transfer Failed > /tmp/srgfwftpstatus
fi  
echo end > /tmp/srgfwftpcomplete
