On Oct 5, 2009, at 10:39 , Markus Friedrich wrote:

i want to create a sandbox of a JSP Wiki (like http://sandbox.jspwiki.org/) . I thought the easiest way would be to override the directory of the wikipages every night. As a special feature, i want to create a plugin which gives the user the opportunity to save/load all wikipages. Is there anything similar i could use or has anyone else developed such a feature?

Here's the script which powers sandbox.jspwiki.org. Run from cron :-)

---------------------
#!/bin/sh

USERNAME=MyName
PASSWD=MyPassword

WWWROOT=/p/web/www-data/sandbox.jspwiki.org/
WIKIPAGES=${WWWROOT}/wikipages/
CONTENTS=${WWWROOT}/JSPWiki-samplepages.zip
WORKDIR=${WWWROOT}/workdir/

wget --http-user=${USERNAME} --http-passwd=${PASSWD} -O - http://sandbox.jspwiki.org/manager/html/stop?path=/ >/dev/null

cd ${WIKIPAGES} && rm -rf -- * && unzip ${CONTENTS}
cd ${WORKDIR} && rm -rf -- *
cd ${WWWROOT}/webapps/JSPWiki/WEB-INF/ && rm -f userdatabase.xml* groupdatabase.xml*

wget --http-user=${USERNAME} --http-passwd=${PASSWD} -O - http://sandbox.jspwiki.org/manager/html/start?path=/ >/dev/null
----------------------------

You need to have the Tomcat manager enabled, of course. Works with VersioningFileProvider. Has worked without change from 2.4 to 2.8, probably earlier too. Tweak as necessary to fix to your environment (at least the ?path=/ might need something).

HTH, Janne

Reply via email to