Skip to content

Commit

Permalink
VER 0.1.1 - (2012-10-22) - Added log functionality. All general log o…
Browse files Browse the repository at this point in the history
…utput from AutoCouchbaseBackup script goes to LOGFILE. All couchbase backup related output goes to LOGCOUCHBASE
  • Loading branch information
bnaydenov committed Oct 22, 2012
1 parent 0f6d111 commit 438f44d
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions autocouchbasebackup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash
# AutoCouchBaseBackup 2.0 Backup Script
# VER. 0.1
#!/bin/bash
# AutoCouchBaseBackup is a script which backup Couchbase server 2.0
# VER. 0.1.1
# Author: Bogdan Naydenov bnaydenov@gmail.com

# Note, this is a lobotomized port of AutoMySQLBackup
Expand Down Expand Up @@ -29,7 +29,7 @@


# Version of this script
VER='0.1'
VER='0.1.1'

# Path to couchbase bin directory where cbbackup is located
PATHTOCOUCHBASEBIN="/opt/couchbase/bin"
Expand All @@ -55,6 +55,9 @@ DNOW=`date +%u` # Day number of the week 1 to
DOM=`date +%d` # Date of the Month e.g. 27
M=`date +%B` # Month e.g January
W=`date +%V` # Week Number e.g 37
LOGFILE=$BACKUPDIR/$DATE.log # Logfile Name for general log output from AutoCouchbaseBackup script
LOGCOUCHBASE=$BACKUPDIR/Couchbase-Backup_$DATE.log # Logfile Name for couchbase backup related output


OPT="" # OPT string for use with cbbackup

Expand Down Expand Up @@ -154,6 +157,12 @@ LATESTLINK="yes"
#=====================================================================
# Change Log
#=====================================================================
# VER 0.1.1 - (2012-10-22)
# - Added log functionality. All general log output from
# AutoCouchbaseBackup script goes to LOGFILE. All couchbase backup
# related output goes to LOGCOUCHBASE

#
# VER 0.1 - (2012-10-18)
# - Initial Release - basic backup functionality with daily, weekly
# and monthly rotation. Backup all bucket on all nodes
Expand All @@ -168,6 +177,19 @@ LATESTLINK="yes"
#=====================================================================
#=====================================================================


# IO redirection for logging.
touch $LOGFILE
exec 6>&1 # Link file descriptor #6 with stdout.
# Saves stdout.
exec > $LOGFILE # stdout replaced with file $LOGFILE.

touch $LOGCOUCHBASE
exec 7>&2 # Link file descriptor #7 with stderr.
# Saves stderr.
exec 2> $LOGCOUCHBASE # stderr replaced with file $LOGCOUCHBASE


shellout () {
if [ -n "$1" ]; then
echo $1
Expand Down Expand Up @@ -318,3 +340,5 @@ if [ "$POSTBACKUP" ]; then
echo ======================================================================
fi

#close stdout and stderr
exec 6>&- 7>&-

0 comments on commit 438f44d

Please sign in to comment.