Store WeBWorK's temporary files in a separate directory or partition

From WeBWorK
Revision as of 17:44, 1 February 2012 by Apizer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you are running a large WeBWorK installation (say with 500 or more students) or your installation is on a slower server, it is a good idea to put all of WeBWorK's temporary files in a separate directory or partition usually named wwtmp. Any files or directories under the directory wwtmp needed by WeBWorK will be automatically recreated if needed so there is no reason to back up this directory. Not backing up this directly can significantly lessen the backup load on large installations.


Create the wwtmp directory or partition

You can set up wwtmp as a separate partition or simply as a directory. Create the wwtmp directory (or partition) under Apache's main server document root which is set during the Apache installation. For Ubuntu, this is /var/www which we will assume in the instructions below.

Actually you can do this at any time and your active courses will continue to function seemingly without change. The only change behind the scenes will be that temporary files will be stored in a different location.

First we set the group and permissions for the wwtmp directory. As root (or using sudo), run the commands


# cd /var/www
# chgrp wwdata wwtmp
# chmod ug+w wwtmp
# chmod g+s wwtmp

Set up WeBWorK to use the wwtmp directory

Next we have to edit global.conf so that WeBWorK uses the new wwtmp directory. Since we have a working WeBWorK system, first we make a backup copy of global.conf.


$ cd /opt/webwork/webwork2/conf
$ cp global.conf global.conf.bak1
$ gedit global.conf

Now edit global.conf. Find the lines

$webworkDirs{htdocs_temp}   = "$webworkDirs{htdocs}/tmp";
$webworkURLs{htdocs_temp}   = "$webworkURLs{htdocs}/tmp";

and replace them by

#$webworkDirs{htdocs_temp}   = "$webworkDirs{htdocs}/tmp";
#$webworkURLs{htdocs_temp}   = "$webworkURLs{htdocs}/tmp";
$webworkDirs{htdocs_temp}   = '/var/www/wwtmp';
$webworkURLs{htdocs_temp}   = '/wwtmp';

Next find the lines

$courseDirs{html_temp}   = "$courseDirs{html}/tmp";
$courseURLs{html_temp}   = "$courseURLs{html}/tmp";

and replace them by

#$courseDirs{html_temp}   = "$courseDirs{html}/tmp";
#$courseURLs{html_temp}   = "$courseURLs{html}/tmp";
$courseDirs{html_temp}   = "/var/www/wwtmp/$courseName";
$courseURLs{html_temp}   = "/wwtmp/$courseName";

Then save the file and quit. If you look at the wwtmp directory you will find it empty but after you restart apache and then access some WeBWorK problems, you will find temporary directories and files in wwtmp. Remember you have to restart apache for these changes to take effect.

See Clean Out Temporary Files for information on removing WeBWorK's temporary files.

follow us