Scheduled Joomla backups with Akeeba Remote CLI
When I started to build Joomla websites, backups never were a priority on my list. Foolishly relying on the shared hosting backups, got me burned a couple of times. They say that you learn from mistakes and that’s exactly what I did.
I stopped relying on the backups from shared hosts, especially the cheaper ones. Most of the time you get a 2 day backup, which overwrites itself. Not really useful if you notice, that the website got hacked after 3 days.
Joomla sites can be backed up manually, but who really has the time to go through every client website; doing a backup of the files and database on a daily basis? I don’t, so that’s why I searched for a FREE automatic scheduled backup solution.
The perfect solution is Akeeba Remote CLI.
Akeeba Remote Control CLI (Remote CLI for short) is a command-line PHP application which allows you to update Akeeba Backup as well as take, list and download backups of your sites, as long as they have Akeeba Backup installed.www.akeebabackup.com
What does the Remote CLI do?
I’ve setup everything on a windows machine. When Remote CLI connects to the website it:
- Updates the Akeeba backup component (if available),
- creates a backup,
- downloads the backup to the computer,
- deletes the backup from the server.
Enable remote API in Akeeba Backup and create a Secret key
Login to your Joomla administrator and open up the Akeeba Backup component. Click on the Options, Front-end backup and enable front-end and remote backup. Create a secret key and save the changes.
Install PHP-CLI on a Windows computer
Remote CLI is a command-line application, which means it runs in a command line window. It doesn’t have a GUI. You’ll have to install a command line version of PHP (a.k.a. PHP-CLI). For more detail read the help docs on how to install and prepare everything.
Download the remote.phar file
Download Remote CLI (remote.phar) and copy it in the
C:/PHP folder (as recommended in the instructions).
Create a Batch file
Create a new
backup.BAT file inside the
C:/PHP folder. Copy the bellow command and change the default settings.
c:\PHP\php remote.phar –action=update –host=http://www.website.com –secret=“yourSecretPassword”
c:\PHP\php remote.phar –action=backup –host=http://www.website.com –secret=“yourSecretPassword” –download –dlmode=http –dlpath=“c:\WebBackup\website” –delete
You have to change the
yourSecretPassword (the password that you set inside the Akeeba Backup component),
c:\WebBackup\website (the directory to download the backup to).
The example is just for one website, you can add as many as you wish to the .BAT file.
Scheduling the backups with Windows Task Scheduler
Double clicking the .BAT file should open a command line window and hopefully start to create the backup on the site and then downloading to the specified folder. If it works, open up the Windows task scheduler and click on the Create Basic Task. Then go through the steps, choosing the frequency of the backups and which program to start — backup.BAT.
If you have a custom server that runs all the time, you can be almost worry-free with a setup like this. For me it’s enough to have a home PC turned on every 3rd day. Don’t forget to test the backups with Akeeba Kickstart, from time to time.