From a333a755770d0514290cfe946dbd28edca3eb7c6 Mon Sep 17 00:00:00 2001 From: RYAN A RIVERA Date: Tue, 29 Oct 2024 12:00:44 -0500 Subject: [PATCH] Added list feature to mu2e ots snapshots --- tools/get_mu2e_snapshot_data.sh | 2 +- tools/get_mu2e_snapshot_database.sh | 2 +- tools/reset_mu2e_ots_snapshot.sh | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/get_mu2e_snapshot_data.sh b/tools/get_mu2e_snapshot_data.sh index aa1fb732f..8a76fd24f 100755 --- a/tools/get_mu2e_snapshot_data.sh +++ b/tools/get_mu2e_snapshot_data.sh @@ -92,7 +92,7 @@ ${cmd} 2> "$errlog" if [[ -s "$errlog" ]]; then error=`cat "$errlog"` # File exists and has a size greater than zero - echo "THERE WAS AN SCP ERROR: You can use the following error to decide what to do" + echo -e `date +"%h%y %T"` "get_mu2e_snapshot_database.sh [${LINENO}] \t THERE WAS AN SCP ERROR: You can use the following error to decide what to do" echo $error rm $errlog exit diff --git a/tools/get_mu2e_snapshot_database.sh b/tools/get_mu2e_snapshot_database.sh index 07bad3a5f..0bd263ca0 100755 --- a/tools/get_mu2e_snapshot_database.sh +++ b/tools/get_mu2e_snapshot_database.sh @@ -92,7 +92,7 @@ ${cmd} 2> "$errlog" if [[ -s "$errlog" ]]; then error=`cat "$errlog"` # File exists and has a size greater than zero - echo "THERE WAS AN SCP ERROR: You can use the following error to decide what to do" + echo -e `date +"%h%y %T"` "get_mu2e_snapshot_database.sh [${LINENO}] \t THERE WAS AN SCP ERROR: You can use the following error to decide what to do" echo $error rm $errlog exit diff --git a/tools/reset_mu2e_ots_snapshot.sh b/tools/reset_mu2e_ots_snapshot.sh index 084294139..4e61c7f08 100755 --- a/tools/reset_mu2e_ots_snapshot.sh +++ b/tools/reset_mu2e_ots_snapshot.sh @@ -31,6 +31,9 @@ echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t\t for exam echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t\t\t reset_mu2e_ots_snapshot.sh --name a" echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t" echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t" +echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t\t or to see potential names..." +echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t\t\t reset_mu2e_ots_snapshot.sh --list" +echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t" #return >/dev/null 2>&1 #return is used if script is sourced @@ -39,6 +42,15 @@ echo echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t Extracting parameters..." echo +if [[ "$1" == "--list" ]]; then + echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t Listing existing snapshots (format = snapshot__Data/database.zip):" + ssh mu2eshift@mu2egateway01 "ls -lrta /mu2e/DataFiles/UserSnapshots/" + echo + echo -e `date +"%h%y %T"` "reset_mu2e_ots_snapshot.sh [${LINENO}] \t Existing snapshots above are in format = snapshot__Data/database.zip" + echo + return >/dev/null 2>&1 #return is used if script is sourced + exit #exit is used if script is run ./reset... +fi if [[ "$1" == "--name" && "x$2" != "x" ]]; then SNAPSHOT="$2"