[SOLVED] How to change the frequency of Backup in Dropbox

Dear Experts,

Currently erpnext backup getting saved in dropbox on daily basis.

But we need backup for every 6 hours or whenever we wish to take backup.

Kindly suggest the procedure to do so.

1 Like

Currently only daily or weekly backups are taken.
You can achieve half day backups with custom app and hooks.

For simple workaround use the following code,

Add this to
Setup > Custom Script > New
Doctype : Dropbox Backup
Script :

frappe.ui.form.on("Dropbox Backup", "refresh", function(frm){
	if(frm.doc.send_backups_to_dropbox){
		frm.add_custom_button(__("Take Backup"), function() {
			frappe.call({
				method: "frappe.integrations.doctype.dropbox_backup.dropbox_backup.take_backups_dropbox",
				freeze: true,
				freeze_message: __("Taking backup"),
				callback: function(r){
					if(!r.exc) {
						frappe.msgprint(__("Backup taken successfully"));
					} else {
						frappe.msgprint(__("Error while taking backup. <br /> " + r.exc));
					}
				}
			});
		})	
	}
});

If everything is configured right you should see a button on Dropbox Backup form.

3 Likes

@revant_one Thank you soo much Revant.

By the way, is it a current backup or half day backup? Because when I clicked “Take Backup”, immediately backup gets stored in dropbox.

It takes a new backup on the click of the button and uploads it.

@revant_one Thanks Revant… It really helped us a lot.