Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 581d0059 authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Option for recovering from previous dump

ref #1
parent 30bc3641
......@@ -169,13 +169,19 @@ if [[ ! -d $RESIFDD_DATADIR ]]; then
exit 1
fi
# Get the snapshot name for this month
MONTH=$(date +%Y-%m)
SNAPSHOT_DIR=$(ls -d $RESIFDD_DATADIR/validated_seismic_metadata/.snapshot/monthly.${MONTH}*|tail -1)
if [[ ! -d $SNAPSHOT_DIR ]]; then
echo "Error 000 Snapshot directory $SNAPSHOT_DIR does not exist"
exit 1
####################
#
# Option ContinueFrom
#
####################
if [[ -f ${RESIFDD_CONTINUE_FROM_FILE} ]]; then
# Continue from previous report
echo "Recovery file $RESIFDD_CONTINUE_FROM_FILE exists"
cp $RESIFDD_CONTINUE_FROM_FILE $RESIFDD_WORKDIR/recovery.$$
RECOVERY_FILE=$RESIFDD_WORKDIR/recovery.$$
echo "Now using $RESIFDD_WORKDIR/recovery.$$ as recovery file"
else
echo "No recovery file present. Dumping everything now"
fi
# Header for the report :
......@@ -185,20 +191,35 @@ format_report "Year_Network_Station" "Size(MB)" "Dumpdate" "Duration(s)" "Throug
imkdir -p reports
iput -f $LOCAL_REPORT $IRODS_REPORT
##################
#
# Metadata
#
##################
KEY="validated-seismic-metadata"
echo "[$KEY] Starting dump from ${SNAPSHOT_DIR}"
tar cf $RESIFDD_WORKDIR/$KEY.tar --exclude portalproducts -C $SNAPSHOT_DIR $SNAPSHOT_DIR
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 001 while creating tar archive."
zabbix_err "${KEY}:Error 001"
exit 1
fi
if [ ! -z "${RECOVERY_FILE+x}" ] && egrep -q -e ".*($KEY ).*( OK | Skipped ).*" $RECOVERY_FILE ; then
format_report $KEY "-" $(date +%Y-%m-%dT%H:%M:%S --date=@$start) "-" "-" "Skipped" >> $LOCAL_REPORT
else
# Get the snapshot name for this month
MONTH=$(date +%Y-%m)
SNAPSHOT_DIR=$(ls -d $RESIFDD_DATADIR/validated_seismic_metadata/.snapshot/monthly.${MONTH}*|tail -1)
if [[ ! -d $SNAPSHOT_DIR ]]; then
echo "Error 000 Snapshot directory $SNAPSHOT_DIR does not exist"
exit 1
fi
irods_push $KEY
echo "[$KEY] Dump terminated :"
ils -l $KEY
echo "[$KEY] Starting dump from ${SNAPSHOT_DIR}"
tar cf $RESIFDD_WORKDIR/$KEY.tar --exclude portalproducts -C $SNAPSHOT_DIR $SNAPSHOT_DIR
if [[ $? -ne 0 ]]; then
echo "[$KEY] Error 001 while creating tar archive."
zabbix_err "${KEY}:Error 001"
exit 1
fi
irods_push $KEY
echo "[$KEY] Dump terminated :"
ils -l $KEY
fi
####################
#
......@@ -223,6 +244,14 @@ for dir in $(find . -maxdepth 3 -type d | sort); do
YEAR=${YNS[1]}
NETWORK=${YNS[2]}
STATION=${YNS[3]}
# Test if in recovery mode, we should send or not
if [ ! -z "${RECOVERY_FILE+x}" ]; then
if egrep -q -e ".*$YEAR.*$NETWORK.*$STATION.*( OK | Skipped ).*" $RECOVERY_FILE; then
echo "Found OK or skipped in $RECOVERY_FILE for $KEY. Skipping"
format_report $KEY "-" $(date +%Y-%m-%dT%H:%M:%S --date=@$start) "-" "-" "Skipped" >> $LOCAL_REPORT
continue
fi
fi
KEY=${YEAR}_${NETWORK}_${STATION}
echo "[$KEY] Creating tar on $RESIFDD_WORKDIR/$KEY.tar"
tar cf $RESIFDD_WORKDIR/$KEY.tar $dir
......
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