Try ERPNext Buy Support Partners Foundation

Stop automatic backup of database

How to stop automatic database backup. Need urgent help. The server is performing poorly due to these automatic backups.

I have already set “0” in Settings -> Backups.

It may help to say what version of ERPNext and if the performance problem is happening on a new instance or if things had been operating smoothly and this has just started happening.

Thanks @smino for replying.

ERPNext version 13 beta 4.

The performance problem is happening on an existing instance and it has started deteriorating gradually.

ERPNext creates cron jobs to perform the SQL database backups.

On your server, open a terminal. Switch to your ERPNext user. Then use this shell command:

crontab -e

This will open an editor (probably nano or vim). Then you can delete the line which is performing the backups.


Thanks @brian_pond. Would it be possible to add a “nice” invocation to the cronjob that would let it run as scheduled but with a priority that would cause less of a performance impact? Something like:

cd /home/frappe/frappe-bench && nice -1 /usr/local/bin/bench --site all backup >> /home/frappe/frappe-bench/logs/backup.log 2>&1

1 Like

I’ve never tried that. But I’m assuming it would work.

The bench backup command is nothing special. It performs a “mysqldump” command for every Site (database) that it knows about.

If you have better SQL backups tools or schedulers at your disposal, you could remove the cronjob entirely. And just backup the SQL database your way.

Edit : I believe the bench backup command is also backing up the Site’s “public” files. In addition to performing a SQL database backup.

1 Like

Thanks @brian_pond and @smino for the prompt reply to my query.

Yes, I could find out the cron-job set for database backup ( /usr/local/bin/bench --site all backup) using crontab -e with erpnext user login. I have just changed the timing for backup so that it would not hamper the server performance during pick hours of transactions.
It would run in server idol time.

Additionally I found a cron task with following command :
/opt/erpnext/erpnext/env/bin/bench update --auto

What it does? It is set to run once everyday. Is it require so?

Apart from database backup file *.sql.gz, i found that site_config.json is also being backed-up simultaneously and continuously.

That file contains encryption_key, if the key is lost all the password fields need to be reset after restoring db.

Thanks @revant_one. I was unaware of that. So that means site_config.json is backed up with the database by default as a pre-requisite and it is happening by --site all backup command.

This automatically updates ERPNext. Pulling code down from GitHub, updating your local code, applying patches, and potentially making SQL schema changes.

I would strongly recommending disabling this in any Production environment. And instead patch ERPNext in a controlled and planned manner.

1 Like

Ohhhh man. Thanks a lot, @brian_pond. I was unaware of it. I am just disabling it.