Hello,
I am using ncftpd for the admin backups.
Currently I am having problems rate limiting this feature.
According to the ncftpd docs I can use the u-upload-bandwidth-per-user
But when I test the transfer It goes out at full speed, slowing down the server dramaticly.
This is my script Any ideas why it is not working?
/usr/local/directadmin/scripts/ftp_upload.php
I am using ncftpd for the admin backups.
Currently I am having problems rate limiting this feature.
According to the ncftpd docs I can use the u-upload-bandwidth-per-user
But when I test the transfer It goes out at full speed, slowing down the server dramaticly.
This is my script Any ideas why it is not working?
/usr/local/directadmin/scripts/ftp_upload.php
Code:
/bin/sh
FTPPUT=/usr/bin/ncftpput
TOUCH=/bin/touch
PORT=${ftp_port}
if [ ! -e $TOUCH ] && [ -e /usr/bin/touch ]; then
TOUCH=/usr/bin/touch
fi
if [ ! -e $FTPPUT ]; then
echo "";
echo "*** Backup not uploaded ***";
echo "Please install $FTPPUT by running:";
echo "";
echo "cd /usr/local/directadmin/scripts";
echo "./ncftp.sh";
echo "";
exit 10;
fi
if [ ! -e "${ftp_local_file}" ]; then
echo "Cannot find backup file ${ftp_local_file} to upload";
exit 11;
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
if [ ! -s ${CFG} ]; then
echo "${CFG} is empty. ncftpput is not going to be happy about it.";
ls -la ${CFG}
ls -la ${ftp_local_file}
df -h
fi
$FTPPUT -o u-upload-bandwidth-per-user=5000 -f $CFG -V -t 25 -P $PORT -m "$ftp_path" "$ftp_local_file" 2>&1
RET=$?
/bin/rm -f $CFG
exit $RET