Tran Nghi's Site  - Make notes and share experience

Full Backup for Shared Hosting using Directadmin

This post is also available in: English

  1. Make cronjob on directadmin panel to perform daily backup
  2. Make cronjob on a remote linux computer to download the backup

Directadmin has provided a several scripts on this page: http://files.directadmin.com/services/all/

1. Make cronjob on directadmin panel to perform daily backup

Now, you can download the file called: link

  • Make a copy of downloaded file
  • Fill-in your shared hosting account into backup.php script
  • Follow the instruction in the script, that it shall be like

1) Place this file somewhere under your home directory.
A good place might be:

/home/username/backup.php

From the File Manager in DA, that would be: /backup.php

2) Chmod the file to 700. This is very important for security.

3) Edit the above variables.
Most likely, you”ll only need to change the username and password.
If your system uses ssl to connect to DA (https) then you’ll need to set $ssl = 1;

4) Create the cronjob to execute:

/home/username/backup.php

as often as you wish. Usually once per day is the most you’ll want to run it.
To create the cronjob, see: http://www.site-helper.com/misc.html#cron

Usually a very early morning hour, say 5am is best as the load is usually lowest then.

Note that we do not need to add /usr/local/bin/php in front of this php script because of the
#!/usr/local/bin/php -n
line at the very top.

5) check your ‘username’ account. Any emails will be delivered there if it doesn’t work.
If needed, you can test manually via ssh by running:

/home/username/backup.php

2. Make cronjob on a remote linux computer to download the backup

Message