bash script, that uploads a file to ftp server and gives back the success or failed status:

#!/bin/bash
cname=FTPuploadTest
host=192.168.1.1
user=user1
pass=pass1

echo "<<<check_mk>>>";
echo "Version: v1";
echo "<<<local>>>";
/usr/bin/ncftpput -u $user -p $pass $host . /home/test/test.cfg 1>/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "0 $cname - FTP upload test to $host successful";
else
echo "2 $cname - FTP upload test to $host failed";
fi

computer2know :: thank you for your visit :: have a nice day :: © 2018