How to convert ftp_download.php to use ncftpget instead of php

If you wish to use a different ftp downloader for backup files, type, ncftpget can be used to replace php.
To convert to ncftpget, type:

cd /usr/local/directadmin/scritps/custom
nano ftp_download.php

and in the new ftp_download.php file, add the following code

/bin/sh

FTPGET=/usr/bin/ncftpget
TOUCH=/bin/touch
PORT=${ftp_port}

if [ ! -e $TOUCH ] && [ -e /usr/bin/touch ]; then
TOUCH=/usr/bin/touch
fi

if [ ! -e $FTPGET ]; then
echo "";
echo "*** Backup not downloaded ***";
echo "Please install $FTPGET by running:";
echo "";
echo "cd /usr/local/directadmin/scripts";
echo "./ncftp.sh";
echo "";
exit 10;
fi

CFG=${ftp_local_file}.cfg
/bin/rm -f $CFG
$TOUCH $CFG
/bin/chmod 600 $CFG
/bin/echo "host $ftp_ip" >> $CFG
/bin/echo "user $ftp_username" >> $CFG
/bin/echo "pass $ftp_password" >> $CFG

$FTPGET -C -f $CFG -V -t 25 -P $PORT "$ftp_ip" "$ftp_path/$ftp_remote_file" "$ftp_local_file" 2>&1
RET=$?

/bin/rm -f $CFG

exit $RET

Save and exist, and chmod the script to 755.


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 20228