I threw the instructions for backing up Geonode config into a bash file then added a cron rule to root crontab so that it would run reguarly.

You’ll need a folder to save the backups in. I saved the backups using the format geonodeXXXBackup-Y-m-d-h.tgz (XXX is config or data). In my example I used /home/jay/geonode_backups/

Here’s the content of the backup script…

#/bin/bash
# script to backup geonode

echo "Stopping services"
sudo service apache2 stop
sudo service tomcat6 stop
sudo postgresql stop

echo "Making backup"
cd /home/jay/geonode_backups # go into the folder for backup
tar -cvzf geonodeConfigBackup-$(date +%Y-%m-%d-%H).tgz /etc/geonode
tar -zcvf geonodeDataBackup-$(date +%Y-%m-%d-%H).tgz /var/lib/geoserver/geonode-data/

echo "Restarting services"
sudo service apache2 start
sudo service tomcat6 start
sudo postgresql start

Then to add the crontab rule, as root run crontab -e and add the rules:

# backup geonode @ 11:59 every 6th day of the week, every month, every ....
59 23 * * 6 /home/jay/backup_geonode

# remove backups after 300 days
10 12 * * 6 find /home/jay/geonode_backups/ -not -mtime -300 -exec rm {} \;