MyBB Community Forums

Full Version: Re-importing database every 2 hours?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I'm trying to setup a demo site and wondering how i'd go about re-importing a database backup every 2 hours. I don't have root access as I'm on a shared host, however I am able to create cron jobs.

Does anyone know how I'd go about doing this (If I can do this?)

Thanks Smile
You would just have to write a query to drop all tables and then import a sql file to load them all again.

Would probably have to be using a bash script for logging into the DBMS.
Use cron to run a PHP file every two hours to delete all the tables then re-add them again.
if you have cron access, you are better off just building a command to import a backup from mysqldump. when you dump the initial clean setup, just use --add-drop-tables in front so it will not run into errors on the import of the .sql file.