#!/bin/sh T=$(mktemp -d -t -p /var/tmp chef-server.XXXXXXXXXX) D=$(date +%Y-%m-%d) B=chef-server-$D.tar.gz mkdir $T/chef-server-$D chgrp opscode-pgsql $T $T/chef-server-$D chmod g+rwx $T $T/chef-server-$D sudo -u opscode-pgsql /opt/opscode/embedded/bin/pg_dumpall --file=$T/chef-server-$D/chef.dmp --clean ln -s /var/opt/opscode/bookshelf/data $T/chef-server-$D/bookshelf nice tar --create --dereference --directory=$T chef-server-$D | nice gzip --rsyncable -9 > $T/$B nice rsync --preallocate --fuzzy $T/$B backup.openstreetmap.org::backup rm -rf $T