In this article, I’ll explain how to create automated backups of each DirectAdmin user account under one reseller hosting account.
A separate post explains cPanel reseller hosting backup automation.
Table Of Contents (T.O.C.):
- Creating an FTP storage destination directory
- Automating DirectAdmin backups
- DirectAdmin Backup retention
I already wrote about how often backups should be made (and how to save them). Since reseller hosting is used for hosting several websites, doing manual backups for each site is tedious and takes time – I prefer having the server do the job.
JetBackup did finally make DirectAdmin integration, but they have also altered the way the backups are saved, so I can’t use those files to check, edit and restore accounts on my own (without the help of a hosting provider with JetBackup installed on their server).
That’s why I was looking for an alternative solution. This solution requires storage that allows FTP connections. I’ve opted for a Hetzner Storage Box – reasonably priced, fast and reliable.
To make this work, you need a DirectAdmin reseller hosting account, of course. You also need the address of your FTP storage, and its login username and password.
For more details on FTP storage usernames and passwords, see my article about Hetzner Storage Box. Especially chapter 6, where I’ve explained how to create a user sub-account, which we will use for this example (we don’t want to give our hosting server access to the root directory on our storage, as a precaution in case the server gets hacked).
3. Creating an FTP storage destination directory
Using an FTP client, we’ll create a directory called “hosting-backups” on our FTP storage (how to configure FileZilla FTP client).
On the FTP storage, we’ll create a user account that can only access the “hosting-backups” directory (and all its sub-directories, of course). For details see how to create a sub-account on a Hetzner Storage Box.
Write down your FTP storage address, username and password, along with the name of the directory you had created for the backups. In this example that is:
- FTP storage address: u273500.your-storagebox.de
- Username: u273500-sub1
- Password: anything but “admin123” 🙂
4. Automating DirectAdmin backups
Now comes the fun part. With screenshots. Woohoo! 🙂
Log in to your main DirectAdmin reseller hosting account, open the “Manage User Backups” menu and click on the “Schedule backup” button.
Now we get it done in three simple steps. 🙂
Choosing which accounts to backup. You can backup all the accounts, choose which ones you wish to backup, or choose which ones you wish to exclude from the bakcups.
Configuring the time when the backups will be created.
Configuring the backup destination – where to.
I’ll explain point 5 in picture 4 in the next chapter – it’s important.
5. DirectAdmin Backup retention
Every time DirectAdmin backs up a user, it creates a file in this format: “username.tar.zst”.
In our example, that could be “bikegremlin.tar.zst”. If I have more accounts, there would be more files, like “4rooms.tar.zst”, “sportswiser.tar.zst” and so on.
New backups will overwrite the old ones because filenames aren’t changed unless we configure that. How do we do that?
Under point (5) in picture 4, I set “Append” option to add “Week of Month” to the destination path. This results in backups run in the first week of September overwriting any backups created in the first week of August (or any time before that) – but not any backups run on 2nd or 3rd week of a month.
Effectively, I’ve configured backups to be kept for the last 5 weeks (one month). I’ve also configured them to be run once a week, but that’s not important for this chapter. Here’s what that looks like in our example:
What if I wanted to keep backups for one year? I could set the “Append” to add the month of the year, instead of the week of a month. With one note:
With that setup, even if you run backups weekly or daily, every month will only contain the latest backup run in that month. Because the newest backup run in a month overwrites the backups previously created in that same month.
So, if you wish to keep backups for the last year, but also keep several more recent ones, you could configure two backup jobs:
- One job run on say Tuesdays, that Appends “Week of Month” to the destination path (as we did in this example).
- Another job that runs on say every 5th of a month and Appends “Month” to the destination path.
- Alternative: instead of the weekly backups, you could configure daily backups that Append “Day of Week” to the destination path. That way you’ll have the last 7 daily backups, in addition to the last 12 monthly backups (if you configure the monthly backups as explained in the point above).
I like combining weekly with monthly backups, relying on a reliable hosting provider for daily backups, except for websites where losing even one hour of work could be a big problem.
Even the best, most expensive hosting providers have had (and will have) their systems fail (why every website will be hacked). Backups are a way to minimize the damage when (not if) that happens.
Automating backups saves you time and hassle.
2 thoughts on “DirectAdmin reseller hosting backup automation”
Hello, I have checked your article it is very good. I have signed up for the Hetzner account and even I have submitted my local id but their verification failed. Can you guide me?
I’m just another customer – so don’t know how to help you with this problem.
It would probably make sense to contact their support and see if you can sort it out.