FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 4fe944b4 authored by Dr Adam Thorn's avatar Dr Adam Thorn
Browse files

Merge branch 'improve_pre_error_handling' into 'master'

Improve pre error handling

See merge request !1
parents 61051a45 e9250341
No related branches found
No related tags found
1 merge request!1Improve pre error handling
...@@ -36,7 +36,7 @@ else ...@@ -36,7 +36,7 @@ else
fi fi
$SSH root@$SERVER " $SSH root@$SERVER "
set -e
SQLDIR=/var/lib/mysql-files/ SQLDIR=/var/lib/mysql-files/
mkdir -p \$SQLDIR mkdir -p \$SQLDIR
......
...@@ -10,16 +10,19 @@ DST=$3 ...@@ -10,16 +10,19 @@ DST=$3
TAG=${SRC//\//.} TAG=${SRC//\//.}
set -e
#set -xv
LOGDIR=/var/log/chem-zfs-backup-server/ LOGDIR=/var/log/chem-zfs-backup-server/
CONFDIR=/etc/chem-zfs-backup-server/zfs-rsync.d CONFDIR=/etc/chem-zfs-backup-server/zfs-rsync.d
TIME=`date +%s`
LOGFILE=$LOGDIR${HN}_${TAG}.log
if [ -z "$DST" ] ; then if [ -z "$DST" ] ; then
echo Use: $0 hostname destination echo Use: $0 hostname destination
exit 1 exit 1
fi fi
echo $(date): running $0 $1 $2 $3 >>$LOGFILE
if [ -f $CONFDIR/${HN}_${SRC//\//.} ] ; then if [ -f $CONFDIR/${HN}_${SRC//\//.} ] ; then
# This file can define PRE and POST as scripts which are run # This file can define PRE and POST as scripts which are run
echo Including settings from $CONFDIR/${HN}_${TAG} echo Including settings from $CONFDIR/${HN}_${TAG}
...@@ -31,11 +34,16 @@ fi ...@@ -31,11 +34,16 @@ fi
# Prepare the host if required # Prepare the host if required
if [ ! -z "$PRE" ] ; then if [ ! -z "$PRE" ] ; then
$PRE $HN >>$LOGDIR/${HN}_${TAG}-pre.log 2>&1 $PRE $HN >>$LOGDIR/${HN}_${TAG}-pre.log 2>&1
PRE_EXIT=$?
if [ $PRE_EXIT -ne 0 ] ; then
echo PRE script $PRE exited with $PRE_EXIT >>$LOGFILE
exit $PRE_EXIT
fi
fi fi
#set -xv
# Do the backup # Do the backup
TIME=`date +%s`
LOGFILE=$LOGDIR${HN}_${TAG}.log
echo Making snapshot with zfs snapshot $DST@$TIME 2>&1 >>$LOGFILE echo Making snapshot with zfs snapshot $DST@$TIME 2>&1 >>$LOGFILE
zfs snapshot $DST@$TIME zfs snapshot $DST@$TIME
#DEST=`mount | awk ' $1=="'$DST'" { print $3 } '` #DEST=`mount | awk ' $1=="'$DST'" { print $3 } '`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment