XF 2.1 How to turn off the forum everyday between 1 AM and 2 AM


Active member
Hi everyone,

I use a tool like cPanel named "Direct Admin" and I wish to perform a full daily backup of my XenForo website (files and MySQL database).
I can do that easily and plan this everyday thanks to "Direct Admin".
But this full backup lasts around 40 minutes (45GB due to attachments).

In order to ensure DB and files consistency I wish to close the full forum automatically during backup :
  • Stop 5 mn before the time planned for the backup start
  • ReStart 10mn after the estimate backup completion time

Do you know how to schedule a daily forum shutdown thanks to a cron job either at "Direct Admin" level or XENFORO level?

Many thanks in advance



Well-known member
It's probably possible to change the board off setting int he db via a cron task, but i would highly advise against doing this. You don't want to discourage bots from indexing in their peak indexing hours.

If your backup is taking this long, consider making your database smaller.

Offload your attachments to s3 is a great first step.

then there's other cleanups you can do, such as
clean up users (eg, spam accounts)
remove old classifieds / etc dated content

and when you're done, it should back up in a few min. If you miss a few posts, so what? it's close enough.


Active member
The issue is not the size of the database but the quantity of files (attachments) that I store for 20 years.
My website is about Excel and I definitely wish to keep all the files.
The database backup lasts less than one minute in the whole backup process.


Well-known member
Why not look for a different way to do the file backup? You could rsync the files somewhere and the incremental changes would be minimal.

or do a file backup once a month and just do a dB backup nightly.


Active member
You are right, I think that is the best way for me to do that!
I do not know how to setup rsync between 2 servers but I will look for tutorials.
Many thanks for your time and advices!
  • Like
Reactions: arn