I'm on magento 1.8 and have a really strange thing happening at 5am every morning... a maintenance.flag appears in my root folder, putting the site into maintenance mode...

I have tried changing all the passwords etc but it still happens. In the access logs, all I can see is the cron.php (which runs every minute) running at a few seconds after 5am

I've also checked the error logs etc, no idea what is causing this. I've also changed FTP password and root passwords for the server.

Also what happens is I get the attached error when I try to access admin. I restart SQL and it starts working again...

enter image description here

  • 2
    By any chance you have a scheduled backup each night?
    – Marius
    Commented Jul 24, 2014 at 8:56
  • Spot on! Backup running at 5am every morning, thanks for that, any reason why it's not coming out of maintenance mode?
    – user9654
    Commented Jul 24, 2014 at 9:13

1 Answer 1


Based on the comments...
The backup scheduled to run every night puts the website on maintenance mode.
You can configure it not to do so from System->Configuration->System->Scheduled Backup Settings->Maintenance Mode. Set that field to No.
But this will solve only half of the problem.

The backup process should remove the maintenance mode once it is finished.
You problem is that the process does not finish.
There is some deadlock database and you end up with the 2 issues:

  • the maintenance flag is not removed
  • your application cannot connect to the db and you have to restart the mysql service.

My advice is to think of a different backup strategy, or try to identify what is causing the deadlock....or you can always throw blindly more hardware at your server.

Sorry but that's all I can come up with right now. My sysadmin skills are barely reaching zero.

  • Thats great, thanks very much for your help :)
    – user9654
    Commented Jul 24, 2014 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.