Mirroring the Template Files

From Web Developer Network Wiki
Jump to: navigation, search

Mirroring the template dependent files is required to use the UNL Templates on your own server.

The files under http://www.unl.edu/wdn/ need to be synchronized periodically to the same location on your webserver. This ensures that your UNL template based website will have the latest fixes and WDN member contributions.

To do this, first copy down the templates_3.0 directory and place it within a directory titled 'wdn' in the root of your web server. The wdn directory can be downloaded from the WDN Downloads page. http://wdn.unl.edu/downloads/wdn.zip (Register for the WebDevNet Bulletin Board to keep informed of updates).


Synchronizing the files

Once a copy is placed on your server, a synchronization method needs to be chosen to keep the UNL Template files synchronized with the master copies.

The master copy is at http://www.unl.edu/wdn/ and is available as a .zip file.

Pulling the files down usually involves a nightly cron-job or Scheduled task that downloads all the files.

Unix/Linux Servers

A sample cron job task for Unix/Linux/Mac Servers:

wget -rq -nH -np -l 15 --cut-dirs=1 --reject "index.html*,*.LCK" http://wdn.unl.edu/wdn/ -P /var/www/wdn/

Where /var/www/wdn/ is the path that is published as http://example.unl.edu/wdn/ on your website.

Mac OS X

Obtaining wget for Mac OS X Mac OS X does not come with wget. A binary of wget for 10.5 can be found off of Status-Q.

You will need to have administrator access to the computer to install wget.

Here is instructions on how to install wget:

$ curl -O http://www.statusq.org/wp-content/uploads/2008/07/wget.zip
$ unzip wget.zip
$ sudo mkdir -p /usr/local/bin
$ sudo mkdir -p /usr/local/man/man1
$ sudo mkdir -p /usr/local/etc
$ sudo cp wget/wget /usr/local/bin
$ sudo cp wget/wget.1 /usr/local/man/man1
$ sudo cp wget/wgetrc /usr/local/etc

This version of wget was complied on 10.5.6. It has been test on 10.5 and 10.6 but has not been tested on earlier versions. An older version of it can be found at http://www.statusq.org/images/wget.zip. The other install instructions stay the same.

A sample plist file for Mac OS X launchd:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

You will need to chage the following items:

  • /path/to/www/wdn
    change to path of your WDN files
  • username
    change to the user that can write to the path

Then save as /Library/LaunchDaemons/edu.unl.wdn.template-update.plist and run the following command:

$ sudo launchctl load /Library/LaunchDaemons/edu.unl.wdn.template-update.plist


A method for Windows servers:

* download the windows port of wget at http://xoomer.virgilio.it/hherold/#Files
(This is the official windows port that is linked to by http://www.gnu.org/software/wget/wget.html)
* unzip the downloaded file to "C:\Program Files\wget"
* Go to Control Panel -> Scheduled Tasks
* File -> New -> Scheduled Task, name the task something useful
* Double-click the new task, and enter the following value for the Run: field, adjust for your webroot:
"C:\Program Files\wget\wget.exe" -rq -nH -np -l 15 --cut-dirs=1 --reject index.html* http://wdn.unl.edu/wdn/ -P C:\inetpub\wwwroot\wdn\
* Set 'Run as' to: NT AUTHORITY\SYSTEM
* Set the schedule on the Schedule tab
* Click OK, leave the password blank if prompted

To test the task, right click on it and select 'Run'.

Personal tools