Skip to content

Instantly share code, notes, and snippets.

@NKjoep
Created March 18, 2011 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NKjoep/876038 to your computer and use it in GitHub Desktop.
Save NKjoep/876038 to your computer and use it in GitHub Desktop.
This script will backup both your PostgreSQL databases of your jAPS Entando application.
#!/bin/bash
## Title: backup-japs.sh
#
## Description: This script will backup both your PostgreSQL databases of your jAPS Entando application.
## Will write in the current directoy two files: 2010-03-18-1406_PortalExamplePort.backup, 2010-03-18-1406_PortalExampleServ.backup
#
## Usage: backup-japs.sh host port username password project
## Example: backup-japs.sh localhost 5432 agile mypassword PortalExample
#
#
## Author: Andrea D. <nkjoep@gmail.com>
#
if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ] || [ "$5" = "" ]; then
echo Usage: $0 host port username password project
else
CURRENTNOW=`date +%F-%H%M`
PGPASSWORD=$4
echo doing: pg_dump -i -h $1 -p $2 -U $3 -F t -b -v -f ${CURRENTNOW}_${5}Port.backup "$5Port"
pg_dump -i -h $1 -p $2 -U $3 -F t -b -v -f ${CURRENTNOW}_${5}Port.backup "$5Port"
echo doing: pg_dump -i -h $1 -p $2 -U $3 -F t -b -v -f ${CURRENTNOW}_${5}Serv.backup "$5Serv"
pg_dump -i -h $1 -p $2 -U $3 -F t -b -v -f ${CURRENTNOW}_${5}Serv.backup "$5Serv"
PGPASSWORD=''
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment