WeBWorK Main Forum



by Ted Cox -
Number of replies: 1
Is there a standard way to do backup, say for a single course. If I tarred and gzipped and mailed to myself at another machine the contents of course/MAT000 every night would that do it.

In reply to Ted Cox

Re: backup

by Gavin LaRose -
Hi Ted,

That would get some information, but would lose all the information that's in the database. You also need to get all of the data from the WeBWorK mySQL database to back up the course. On my (RedHat) system, the data files for the mySQL database are in /var/lib/mysql, but that may differ for you.

If you're thinking about doing a tar/gzip of the course directory to start with, a possibility would be to do a dump of the mysql tables for the course into that directory first. For example, if /opt/webwork is your WeBWorK root directory, you might do something like
# cd /opt/webwork/courses/MAT000/DATA
# mysqldump -u root -p webwork MAT000_password MAT000_permission MAT000_problem MAT000_problem_user MAT000_set MAT000_set_user MAT000_user > MAT000_backup.sql

And then tar/gzip/etc. the course directory. If you're running WeBWorK 2.4, you'll want to add MAT000_set_locations and MAT000_set_locations_user to the list of tables that you backup.

(The mysqldump command says: dump [-u root] as user root [-p] asking for a password [webwork] the webwork database. We then give a list of tables to dump and send the dump file to MAT000_backup.sql. This will obviously require that you know the mySQL root password.)