Posted on: 12/05/04 12:00pm
By: rjrufo
I'd like to set up a demo site like the one used by the Geeklog Demo to show prospective clients. Is there a script that I can download that will reset the database? Or would I have to write my own?
Resetting database like the Geeklog Demo
Posted on: 12/05/04 12:25pm
By: Dirk
There's nothing special about that script. It's a cronjob that drops the database, creates a new one, imports the backup of the original state, and deletes a few files (uploaded userphotos, etc.). That's all.
bye, Dirk
Resetting database like the Geeklog Demo
Posted on: 12/05/04 04:53pm
By: rjrufo
Ok, I guess that sounds simple enough, I'll work on it to see what I can do.
Thanks Dirk
Resetting database like the Geeklog Demo
Posted on: 12/05/04 08:58pm
By: ScurvyDawg
A file example would be cool to see Dirk.
If your willing.
Resetting database like the Geeklog Demo
Posted on: 12/06/04 03:54pm
By: Dirk
#!/bin/sh
cd /path/to/geeklog/restore
/usr/local/bin/mysql -ugeeklog-user -ppasswd -e 'DROP DATABASE geeklog_demo;'
/usr/local/bin/mysql -ugeeklog-user -ppasswd -e 'CREATE DATABASE geeklog_demo;'
/usr/local/bin/mysql -ugeeklog-user -ppasswd -D geeklog_demo < backup.sql
cd ..
rm -f backups/*.sql
cd /path/to/geeklog/public_html
rm -f images/articles/*
rm -f images/userphotos/*
rm -f backend/*
touch backend/geeklog.rdf
chmod 666 backend/geeklog.rdf
As I said, nothing sophisticated in that script ...
Two important notes:
- Don't install the File Management plugin on a demo site - it could be used to upload, approve, and execute scripts
- Disable PHP in Static Pages in the plugin's config.php file. Otherwise, anyone could just enter and execute arbitrary PHP scripts
bye, Dirk
Resetting database like the Geeklog Demo
Posted on: 04/14/06 11:36am
By: Anonymous (julianna)
Hi, Dirk.
I tried the script you provided, and I get the following output:
/path/to/geeklog/restore/cronjob.txt: line 5: /usr/local/bin/mysql: is a directory
/path/to/geeklog/restore/cronjob.txt: line 6: /usr/local/bin/mysql: is a directory
/path/to/geeklog/restore/cronjob.txt: line 7: /usr/local/bin/mysql: is a directory
.
The database continues to be intact (I created an extra story which is not in the backup.sql file so I could see the difference).
Is there any reason why the cronjob would simply validate the existance of the directory rather than perform the task at hand? Is this something I need to address with my host?
This is my first time working with a cronjob.
Thanks.
Resetting database like the Geeklog Demo
Posted on: 04/14/06 01:01pm
By: Dirk
As the error message says: /usr/local/bin/mysql appears to be a directory instead of the mysql executable. While that's a bit odd, you'll have to find out where the executable resides (ask your hosting service if you can't figure it out).
bye, Dirk
Resetting database like the Geeklog Demo
Posted on: 04/14/06 01:39pm
By: Anonymous (julianna)
Oops. That's my mistake. When I read the script I thought I was supposed to point to the mysql directory. I'll ask them for the path to the mysql executable.
Thanks.
Resetting database like the Geeklog Demo
Posted on: 04/14/06 03:43pm
By: Anonymous (julianna)
It turns out my host doesn't allow access to the mysql executable for security reasons. Is there any other way I can automate the dropping, creating and populating of the database?
Thanks.
Resetting database like the Geeklog Demo
Posted on: 04/15/06 01:13pm
By: Anonymous (julianna)
After much more trial and error and some work with PHP, it turns out it was not working because of the "/usr/local/bin/". Once I got rid of that (I also didn't need the first two lines), everything worked perfectly!
Thanks.