Trigger scheduled backup (CLI)

Hi!

Is it possible to trigger a scheduled backup via command line?

Let’s assume, you have two scheduled backups: a full backup once a week (Sunday) and an incremental backup 6 days of the week (Monday to Saturday). To trigger one of these backups manually, you can login to webmin, go to: Virtualmin -> Backup and Restore -> Scheduled Backups -> click “Backup” under “Actions”.

I would like to force the execution of the backup via command line. Is this possible?

I do not want to backup a specific virtual server (which would be: virtualmin backup-domain --dest … --domain …), but a scheduled backup with all settings configured. I understand that these backup configs are stored in:

/etc/webmin/virtual-server/backups/…

Thanks
Michael

It is, unfortunately, not in the virtualmin command line client, but it can be done via a bit of trickery.

In /etc/webmin/virtual-server there will be one or more files named something like “backup.pl --id 87873427221”. You can see which one you need in the UI by hovering over the description of the scheduled backup. Or, you can see the backup IDs with “# virtualmin list-scheduled-backups --multiline”

Running that line on the command line, as in:

# ./backup.pl --id 87873427221

That will kick off the backup. Note that it won’t stop the same backup from happening when it is scheduled to happen.

I’ll ask Jamie to add this capability to the CLI, as it would be easy to make this possible.

Oh, wait! I just realized that’s actually using the API command, indirectly.

You can do this, it’s just not very well documented.

# virtualmin backup --id 4876273683

Will run the scheduled backup with ID 4876273683. And, as mentioned, you can find out the ID from “virtualmin list-scheduled-backups --multiline”.

Hey that’s pretty neat, I didn’t know how to do that, I’m glad Joe figured that one out :slight_smile:

-Eric

PERFECT! Many thanks Joe :slight_smile:

Michael