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


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Ftp
Top Level » DirectAdmin

How to convert ftp_download.php to use ncftpget instead of phpLast Modified: Apr 26, 2012, 4:35 pm
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/scripts/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.
 
Related Helpfiles
How to convert ftp_upload.php to use ncftpput or curl instead of php

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST