Virtualmin: How to set DB backups with dynamic names
This is a quick guide showing how to easily set-up automated backups in Virtualmin with dynamic names.
Go to Virtualmin > Backup and Restore > Scheduled Backups and choose “Add a new backup schedule”.
Next, you need to select which virtual server to backup.
You can set backups for each virtual server you manage in Virtualmin or one that will do in for all of them.
In this example, I will only do backups for the MySQL database.
Now we get to the most important part. We need to set the destination folder.
I usually use /backups/ as the to-go folder for backups. After that, each backup has its own folder named %Y%m%d-%H%M, which will be Year-month-day-hour-minute, and inside I can find the SQL file or archive, based on what I selected.
To have that naming convention work, you must check the “Do strftime-style substitutions on file or directory name” option. Otherwise, it will fail when trying to do a backup.
Depending on the frequency of the backup you can also set it up to delete old backups after a while.
In the example above I perform a backup each day at midnight, the backup is stored in /backups/%Y%m%d-%H%M.
You can play with the settings based on your needs. I would also suggest you visit Virtualmin’s documentation on backup and restore.