reseller user back-up to folder with date

AudiAddict

Verified User
Joined
Oct 10, 2008
Messages
85
I have recently set up my 2nd directadmin server and I would like to back-up my user accounts with the reseller mode to a FTP directory by CRON. I am doing exactly on the first directadmin server and it works perfectly.

I have set this up on the 2nd server and just tested it by starting it manually (choosing the option --> now at the top of the page) and it runs fine. The only problem is that it's placing the back-up of the accounts in the root folder of my FTP directory and not in date folders like my first server.

So the difference between my directadmin server is :

Server 1 --> back-up to FTP --> /13-2-2013/*
Server 2 --> back-up to FTP --> /*

My cron and ftp settings are exactly the same.

Can anybody tell me how to set this up? I might of configured this somewhere in the past but I can't seem to find the config file or script to do this?
Or is it not doing this because I did a run now option instead of wait for the cron schedule to trigger?

PS: The first server is not running a 2nd script and renaming stuff afterwords as far as I know.
 
Ok I did find a custom ftp_upload.php file in my scripts/custom folder with the following modification :

date=`date +'%Y-%m-%d'`
ftp_path=${ftp_path}/${date}/


$FTPPUT -f $CFG -V -t 25 -m "$ftp_path" "$ftp_local_file" 2>&1

I was glad to find this, i copied this file to other server and set chmod and chown. Now back-up doesnt work at all it says :

User admin has been backed up. <11:03:01>
cannot find file:
<11:03:01>

The User backups have been uploaded to ftp://myiphere

Seems I'm missing another modification to make a folder maybe? Not sure why it says can't find file? And why this works on my other server?
 
You set this up or someone set it up for you. So it's unlikely any of us will know how it was set up or why.

Jeff
 
I agree, but anybody know how to set up reseller back-up to ftp and have it automatically create folder names with dates? I don't mind doing it differently than on my first server.
 
Anybody know how to set this up?

I would like to have the default reseller back-up function to back-up data to FTP in a /%date%/ folder instead of putting it in the root.

Which files should I change to get this to work?
 
Got it to work by doing the following:

copy ftp_upload.php to custom scripts folder and add/change the bold 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

date=`date +'%Y-%m-%d'`
ftp_path=${ftp_path}/${date}/

$FTPPUT -f $CFG -V -t 25 -P $PORT -m "$ftp_path" "$ftp_local_file" 2>&1
RET=$?


/bin/rm -f $CFG

exit $RET

Probably a good idea to save / add to faq etc. This modification should be default in my honest opinion, now all back-ups are placed in folders with a date name and not being overwritten.
 
Last edited:
Back
Top