Cron Job to reset demo site every hour

Permalink
I am adding this post because I could not find a clear answer in the forum or on the internet.

This process worked for me and I expect there are other ways to accomplish it.

My server is a shared hosting server with cPanel for the sites control panel. I do not know what other control panels offer or whether this will work with other control panels.

I offer it as a guide, not a definitive answer for all situations.


Now that the disclaimers are done, this is how you do it.

1. Set up your Concrete5 demo site. Other posts in the forum gave me the clues needed to set up the demo. If you can't find those posts, send me a message and I will tell you what I did.

2. Log into the demo site as admin and go to the DASHBOARD.

3. In SITEWIDE SETTINGS >> Disable the cache AND clear the cache

4. In SYSTEM & MAINTENANCE >> Click the Backup & Restore tab >> Run Backup

5. Download the .sql backup file and save to a folder or the desktop.

6. FTP the file to a folder on the site server. (I named my folder "0db" to put it at the top of the concrete5 folders, I did give the folder 755 permissions, but that may not be necessary.)

7. Go to your cPanel control panel and under ADVANCED click "Cron Jobs"

8. Add a valid email address and SAVE.

9. Under COMMON SETTINGS select the interval you desire (I picked 1X/hour)

10. In the COMMAND box, copy / paste the sequence below. Make sure your change the a's, b's, c's and PATH to match your sites information.

mysql --host=localhost(Change if not localhost) --user=aaaaa_aaaa --password=bbbbbbbbb --database cccc_cccc < /home/full/path/mysite.com/database_folder/dbu_filename.sql

11. Click ADD NEW CRON JOB

12. Test it to make sure it works as you expected.

Other thoughts.

I set up the first cron job to run every minute to test the site and make sure there were no errors. If there is an error, the email address you entered in step 8 will receive a message. AFTER you are satisfied it is working, then edit the job and select the common settings you desire.

You can look at my demo site athttp://myc5demo.com.

Hope this helps.

Jerlo

jerlo727
 
creativesolutions replied on at Permalink Reply
creativesolutions
Successfully recreated this on Dreamhost servers. Excellent tut.

G'day sir.
Mnkras replied on at Permalink Reply
Mnkras
Your gonna have an issue with files building up, and server security,

check out this:http://www.concrete5.org/documentation/how-tos/developers/create-yo...

I personally modded it,