This page contains examples of automating Pykwiki.

Automatic Pull and Cache

This example is useful if you have multiple or remote contributers committing to a project source/ directory stored in a git repository, and you want to automatically update the web-page.

# Example automated Pull & Cache cron

die() {
    echo "$1"
    exit 1

unset GIT_DIR
cd $project_dir || die "Could not CD to $project_dir"
git pull origin master ||  die "Could not git-pull"
pykwiki cache -f || die "Could not cache files"

Then, to run that script as a cron, save it as, and add the following entry in your user's crontab.

*/5 * * * * /home/hpotter/ > /tmp/pykwiki-pull-cron.out 2>&1

Cache, Commit, and Push

A simple script to cache source files, commit everything, and push to a git repository might be:

cd $project_dir || exit 1
pykwiki cache -f
git add --all
git commit -m "Updated MyPykwikiProject"
git push origin master