Commit 02a49ef1 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files


parent ea0e8c94
......@@ -95,11 +95,12 @@ for dir in $(find . -maxdepth 3 -type d); do
log "[$KEY] idos checksum: $irods_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/previous.tar $KEY/previous_to_delete.tar
imv $KEY/latest.tar $KEY/previous.tar # Rename latest distant dump tp "previous"
if [[ $? -ne 0 ]]; then
# Something wrong moving remote file arround
log "[$KEY] There where something wrong moving $KEY/previous.tar, cancel iput" "error"
irm -f $KEY/previous_to_delete.tar
# zabbixsnd $KEY
......@@ -118,10 +119,15 @@ for dir in $(find . -maxdepth 3 -type d); do
log "[$KEY] Error sending file to irods. The command was: iput --lfrestart $RESIFDD_WORKDIR/$KEY.lfrestart --retries 5 -T -K -f $RESIFDD_WORKDIR/$KEY.tar $KEY/latest.tar" 'error'
log "[$KEY] Rolling back from $KEY/previous.tar to $KEY/latest.tar"
# Roll back
# TODO : section à tester
irm -f $KEY/latest.tar
imv $KEY/previous.tar $KEY/latest.tar
exit 1
# Recover previous from the safety copy
imv $KEY/previous_to_delete.tar $KEY/previous.tar
# Alert to zabbix
# Cleaning up the safety previous file
irm -f $KEY/previous_to_delete.tar
log "[$KEY] Sent successfully"
log "Cleaning generated tar $RESIFDD_WORKDIR/$YEAR_$NETWORK_$STATION.tar"
Supports Markdown
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