Can you run scripts pre/post backup?

Hi. I’d like to run some scripts pre and post backup, but can’t see an option to do so. Is this something that can be done?

Sure, you can run scripts whenever you want!

Could you take a step back and describe the problem you’re trying to solve?

Well, I keep running out of space during the backups - wouldn’t be so bad if it didn’t create the backup and then compress it but, but oh well. But I really don’t want to keep the necessary disk space around at all times because that costs money. All backups go to S3 and don’t stick around once done.

So I’d like to run a pre script that creates a volume and attaches it to my vm mounted to the relevant path. Then once the backup is completed, a post script should run to unmount the volume, then detach and delete. That way I’m only paying for the space for the duration of the backup. I don’t see any options in the settings page for pre and post scripts though?

1 Like

That’s an unusual use case, as disk space just isn’t that expensive. Perhaps you should use the push uploads to S3 plugin (I can’t remember just what it’s called, but it’s in the discourse github repo) so that you could then do database-only backups, reducing the need for so much disk. (or push all uploads to S3)

1 Like

Hmm, that could be a good idea, yeah. Paying for multiple copies of the uploads on S3 right now courtesy of the backups. By pushing the uploads onto S3 and then doing non-upload backups we’d only have to pay to store them once.

On the costs, while we’re happy to pay for things that we do need, we’re a not for profit community group, funded by donations from our members, so we try to not to spend unnecessarily :slightly_smiling_face:.