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
fi
$SSH root@$SERVER "
set -e
SQLDIR=/var/lib/mysql-files/
mkdir -p \$SQLDIR
......
......@@ -10,16 +10,19 @@ DST=$3
TAG=${SRC//\//.}
set -e
#set -xv
LOGDIR=/var/log/chem-zfs-backup-server/
CONFDIR=/etc/chem-zfs-backup-server/zfs-rsync.d
TIME=`date +%s`
LOGFILE=$LOGDIR${HN}_${TAG}.log
if [ -z "$DST" ] ; then
echo Use: $0 hostname destination
exit 1
fi
echo $(date): running $0 $1 $2 $3 >>$LOGFILE
if [ -f $CONFDIR/${HN}_${SRC//\//.} ] ; then
# This file can define PRE and POST as scripts which are run
echo Including settings from $CONFDIR/${HN}_${TAG}
......@@ -31,11 +34,16 @@ fi
# Prepare the host if required
if [ ! -z "$PRE" ] ; then
$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
#set -xv
# Do the backup
TIME=`date +%s`
LOGFILE=$LOGDIR${HN}_${TAG}.log
echo Making snapshot with zfs snapshot $DST@$TIME 2>&1 >>$LOGFILE
zfs snapshot $DST@$TIME
#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