-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathev-backup.sh
50 lines (42 loc) · 1.8 KB
/
ev-backup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
########################################
# EisenVault Backup Script #
# Author: Vipul Swarup, November 2016 #
# Backups a given Alfresco installation#
# to Microsoft Azure #
########################################
BASEDIR=$(dirname "$0")
## Initialize config parameters ##
. $BASEDIR/ev-backup.config
echo "Backing up from $BAK_SOURCE_FOLDER" >>$EV_BAK_LOG_FILE 2>&1
## Shut down alfresco's tomcat ##
#$BAK_SOURCE_FOLDER/tomcat/bin/shutdown.sh >>$EV_BAK_LOG_FILE 2>&1
## Do a Postgresql dump ##
. $BASEDIR/postgre-dump.sh
# Check to see if we're at the first of the month.
# If we are on the 1st day of the month, then run
# a full backup. If not, then run an incremental
# backup.
date==`date '+%d'`
#echo "Date is $date"
#if [[ $date = 06 ]];
#then
echo "Running Full backup: duplicity --full-if-older-than $NUM_DAYS_TO_KEEP $BAK_SOURCE_FOLDER azure://$AZURE_CONTAINER" >>$EV_BAK_LOG_FILE 2>&1
duplicity --full-if-older-than $NUM_DAYS_TO_KEEP $BAK_SOURCE_FOLDER azure://$AZURE_CONTAINER >>$EV_BAK_LOG_FILE 2>&1
#else
# echo "Running Incremental backup: duplicity $BAK_SOURCE_FOLDER azure://$AZURE_CONTAINER" >>$EV_BAK_LOG_FILE 2>&1
# duplicity $BAK_SOURCE_FOLDER azure://$AZURE_CONTAINER >>$EV_BAK_LOG_FILE 2>&1
#fi
## Remove backups older than $NUM_DAYS_TO_KEEP Days ##
echo "Running duplicity remove-older-than $NUM_DAYS_TO_KEEP --force azure://$AZURE_CONTAINER" >>$EV_BAK_LOG_FILE 2>&1
duplicity remove-older-than $NUM_DAYS_TO_KEEP --force azure://$AZURE_CONTAINER >>$EV_BAK_LOG_FILE 2>&1
## Start Up alfresco's tomcat ##
#$BAK_SOURCE_FOLDER/tomcat/bin/startup.sh >>$EV_BAK_LOG_FILE 2>&1
# Unset environment variables used by backup script
unset BAK_SOURCE_FOLDER
unset AZURE_CONTAINER
unset AZURE_ACCOUNT_NAME
unset AZURE_ACCOUNT_KEY
unset PASSPHRASE
unset EV_BAK_LOG_FILE
unset PGPASSWORD