One day that server is gonna crash and that calendar database will be gone.
As it is it happened the day I was going to write my export script.
I was lucky enough to have some backup.
But it's not gonna get me again. So I started writing my daily dump script.
It's not done quite yet.
But the main step is done.
I found out how to successfully dump the calendar database.
The command to do so is:
sudo -u _calendar /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_dumpall -h /var/run/caldavd/PostgresSocket/ -f /Users/Shared/calendar_$(date +%Y%m%d).pgdump