Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script creating a static dump of a Trac instance
#!/bin/sh
src=/path/to/trac
dst=$src.tmp
port=54134
target=$dst/localhost\:$port
pidfile=$dst/pid
set -x
test -f $pidfile && kill `cat $pidfile`
rsync -a --delete $src/ $dst
cd $dst
nice tracd -p $port -b localhost --single-env $dst \
--basic-auth="*",$dst/.htpasswd,$dst -d --pidfile=$pidfile || exit 1
sqlite3 db/trac.db "update permission set username = 'anonymous' where \
username = 'authenticated';" || exit 1
wget -r -k -l 3 -t 3 -X /changeset -X browser -X log http://localhost:$port
rm $target/wiki/{{Trac,Wiki}*,*action=*,*format=*,*version=*}
rm $target/{timeline\?*,ticket/*format=*,report/*{format=,USER=}*}
rm $target/query*format=*
kill `cat $pidfile` || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment