Automated Remote FTP Backup Shell Script

Saving the data from the server may be a problem, especially if you forget about it. Unfortunately the solution provided by PLESK is not always the best one, thus we have tried to come up with a backup alternative.

The steps we recommend are :

  • Setting/Saving the database daily, with upload on a weekly FTP server
  • Setting/Saving the data on a weekly basis and uploading on a FTP server

When you take a dedicated server, usually the company providing it, allocates a FTP space as well for backup for an extra cost or even included in the cost of the server. This space may be accessed only from their internal network, offering more security for protecting the data. Let’s see what we need to do in this direction.


  • Will dump daily the databases (based on AutoMySQLBackup shell script)
  • Will archive directories what you define (we use usually /etc/ and /var/www/vhosts/*/).
  • Have GPG encryption. (switch ON/OFF)
  • Will upload to remote FTP, weekly (or can daily)
  • Will send mail to ADMIN about job.
  • Will report from remote FTP all files for disk space usage and will also delete files from there.
  • Can restore file from Remote FTP.
  • Split large files into 1GB.
  • More smaller settings.

Setting/Saving the database on a daily basis (locally)
Download the automysqlbackup script from our server, modified in such a way that it creates separate folders for each saving. Thus you may search for a certain database very easily. Copy it on the dedicated server, in the /etc/cron.daily/, execute

  • wget -O /etc/cron.daily/
  • chmod 700 /etc/cron.daily/

folder and change the execution rights.

Edit the file and modify (or not) BACKUPDIR=”/home/backups” (if you maintain this setting, you have to create the folder), MAILADDR=”YOUR-EMAIL-HERE”, and you may leave the rest of the information unmodified.

Setting/Saving the data on a weekly basis and uploading on a FTP server
Download the script and upload it to your server.

Execute the following commands.

  • mkdir /home/backups
  • mkdir /root/backup_script
  • cd /root/backup_script
  • wget -O /root/backup_script/
  • wget -O /etc/cron.weekly/
  • chmod 700 /etc/cron.weekly/
  • chmod 700 /root/backup_script/

Edit /root/backup_script/ and set (compulsory)


DIRS=”/etc /home/backups/ /var/www/httpd/vhosts”






After saving these settings, call the script as follows.

  • sh /root/backup_script/ –backup
  • sh /root/backup_script/ –restore
  • sh /root/backup_script/ –report
  • sh /root/backup_script/ –help

Any bug/idea should be sent via our website

Scroll to Top