Commit e900e166 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Log management

parent b4655aa6
......@@ -11,7 +11,7 @@
# $2 : severity (optionnal, default is INFO)
log(){
[[ -z $2 ]] && severity="info" || severity=$2
logger -t resifdd -p local3.$severity $1
logger -t resifdd -p local3.$severity "$1"
}
####################
......@@ -92,6 +92,9 @@ for dir in $(find . -maxdepth 3 -type d); do
log "[$KEY] The archive on irods is the same as our version. Skipping."
continue
fi
log "[$KEY] local checksum: $local_sha" "debug"
log "[$KEY] idos checksum: $local_sha" "debug"
log "[$KEY] Local checksum differs from last dump. Let's dump it"
irm $KEY/previous.tar > /dev/null 2>&1 # Silently remove previous.tar, ignore errors
imv $KEY/latest.tar $KEY/previous.tar # Rename latest distant dump tp "previous"
......@@ -113,7 +116,7 @@ for dir in $(find . -maxdepth 3 -type d); do
$RESIFDD_WORKDIR/$KEY.tar $KEY/latest.tar # 2>&1 1>&3 3>&- | logger -t 'resifdd' -p local3.error; } 3>&1 1>&2 | logger -t 'resifdd' -p local3.info
RC=$?
if [[ $RC -ne 0 ]]; then
log "[$KEY] Error sending file to irods. The command was : iput --lfrestart $RESIFDD_WORKDIR/$KEY.lfrestart --retries 5 -T -K $RESIFDD_WORKDIR/$KEY.tar $KEY/latest.tar" 'error'
log "[$KEY] Error sending file to irods. The command was: iput --lfrestart $RESIFDD_WORKDIR/$KEY.lfrestart --retries 5 -T -K $RESIFDD_WORKDIR/$KEY.tar $KEY/latest.tar" 'error'
log "[$KEY] Rolling back from $KEY/previous.tar to $KEY/latest.tar"
# Roll back
irm -f $KEY/latest.tar
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment