Close forum in a cron job?

Jaxel

Well-known member
I'm trying to set up a cron job. At the beginning of the cron, I want to close the forums; then reopen the forum when the cron is done. What would be the best way to do this?
 
I am having one major issue with this:
Code:
$this->closeForum();
exec("mysqldump ---");
$this->openForum();

It closes the forum fine... and then fires the exec command.

However, then the system has to wait for the exec command to send an all clear... which could be 10 minutes down the line, since mysqldumps can take a while. However, by then, the php script has been disconnected from the server and the open forum command never gets fired.

Is there some way around this? I thought the new XF cron system was supposed to handle stuff like this.
 
Why wouldn't you?

Don't you shut your forum down while you do your backups so people can't add new stuff to the database?

No I don't shut my forum when doing a mysqldump. During the mysqldump the database is automatically locked during the backup process, so there's no need close the forum through the forum software.
 
No I don't shut my forum when doing a mysqldump. During the mysqldump the database is automatically locked during the backup process, so there's no need close the forum through the forum software.
But even the mysqldump documents explicitly state that the table locks do not guarantee logical consistency.

Either way, this isn't a discussion over whether or not to close the forums... its asking for a fix for a specific problem.
 
Top Bottom