Difference between revisions of "Cedeus DB backups"

From stgo
Jump to: navigation, search
(dump of the (uploaded) GeoNode file data and docs - on CedeusGeonode)
(dump of the GeoNode DB - on CedeusDB)
Line 27: Line 27:
  
 
=> '''ToDo''': check how to open an ftp connection and place the file there... or retrieve it using "wget"?
 
=> '''ToDo''': check how to open an ftp connection and place the file there... or retrieve it using "wget"?
 +
 +
 +
==== Example geonodegisdb93backup.sh ===
 +
<code>
 +
#!/bin/bash
 +
logfile="/home/ssteinig/geonode_db_backups/pgsql.log"
 +
backup_dir="/home/ssteinig/geonode_db_backups"
 +
touch $logfile
 +
 +
echo "Starting backup of databases " >> $logfile
 +
dateinfo=`date '+%Y-%m-%d %H:%M:%S'`
 +
timeslot=`date '+%Y%m%d-%H%M'`
 +
/usr/bin/vacuumdb -z -h localhost -U postgres geonodegisdb93  >/dev/null 2>&1
 +
/usr/bin/pg_dump -U postgres -i -F c -b geonodegisdb93 -h 127.0.0.1 -f $backup_dir/geonodegisdb93-backup-$timeslot.backup
 +
echo "Backup and Vacuum complete on $dateinfo for database: geonodegisdb93 " >> $logfile
 +
echo "Done backup of databases " >> $logfile
 +
# sstein: email notification not used at the moment
 +
# tail -16 /home/ssteinig/geonode_db_backups/pgsql.log | mailx blabla@blub.cl
 +
</code>
  
 
=== dump of the GeoNode user db - on CedeusGeonode ===
 
=== dump of the GeoNode user db - on CedeusGeonode ===
  
 
=== tar/zip of the (uploaded) GeoNode file data and docs - on CedeusGeonode ===
 
=== tar/zip of the (uploaded) GeoNode file data and docs - on CedeusGeonode ===

Revision as of 18:32, 2 December 2014

>> return to Cedeus_IDE


How to set up Backups

notifications

To get notified about the backups via email, a/the shell script may send emails via "mailx" - i.e Nail. => see http://klenwell.com/press/2009/03/ubuntu-email-with-nail/

Btw. postfix may work as well

=> ToDo: Install mail program

dump of the GeoNode DB - on CedeusDB

  • create a shell script that contains the pgdump instructions - see /home/ssteinig/pgdbbackup.sh on CedeusDB
  • test if script or script execution actually works. A simple script for testing may perhaps be this (/home/ssteinig/touchy.sh)
#!/bin/bash 
touch /home/ssteinig/ftw.text

=> ToDo: check how to open an ftp connection and place the file there... or retrieve it using "wget"?


= Example geonodegisdb93backup.sh

  1. !/bin/bash

logfile="/home/ssteinig/geonode_db_backups/pgsql.log" backup_dir="/home/ssteinig/geonode_db_backups" touch $logfile

echo "Starting backup of databases " >> $logfile dateinfo=`date '+%Y-%m-%d %H:%M:%S'` timeslot=`date '+%Y%m%d-%H%M'` /usr/bin/vacuumdb -z -h localhost -U postgres geonodegisdb93 >/dev/null 2>&1 /usr/bin/pg_dump -U postgres -i -F c -b geonodegisdb93 -h 127.0.0.1 -f $backup_dir/geonodegisdb93-backup-$timeslot.backup echo "Backup and Vacuum complete on $dateinfo for database: geonodegisdb93 " >> $logfile echo "Done backup of databases " >> $logfile

  1. sstein: email notification not used at the moment
  2. tail -16 /home/ssteinig/geonode_db_backups/pgsql.log | mailx blabla@blub.cl

dump of the GeoNode user db - on CedeusGeonode

tar/zip of the (uploaded) GeoNode file data and docs - on CedeusGeonode