diff --git a/templates/test_exit_strategy.sh.j2 b/templates/test_exit_strategy.sh.j2 index 9840055a65fe1938ce516a71178c18a287b4c957..3a462a36d5a9bec4e1ccc7be189b17c26ad732b7 100644 --- a/templates/test_exit_strategy.sh.j2 +++ b/templates/test_exit_strategy.sh.j2 @@ -14,10 +14,14 @@ INFO="[INFO]\t" MOUNTPOINT="" DATE="$(date +%Y-%m-%d_%H-%M-%S)" +LOGFILE="/tmp/exit_log_${DATE}.log" + +EXIT_PERL="/usr/local/bin/rosettaExitStrategy/perl/exit_strategy.pl" +EXIT_DB="/tmp/exit.db" # check user privileges if [ $UID -ne 0 ] ; then - "${ERROR}Insufficient privileges. Please use sudo to run this script. Aborting..." + echo -e "${ERROR}Insufficient privileges. Please use sudo to run this script. Aborting..." | tee -a "${LOGFILE}" exit fi cd ~ || exit 1 @@ -42,17 +46,14 @@ dev*) exit 1 ;; esac -echo "${MESSAGE}" | tee -a "${LOGFILE}" - - -EXIT_PERL="/usr/local/bin/rosettaExitStrategy/perl/exit_strategy.pl" -EXIT_DB="/tmp/exit.db" +echo -e "${MESSAGE}" | tee -a "${LOGFILE}" -### GENERATE EXIT DATABASE ### -date | tee -a "${LOGFILE}" -echo -e "\n### GENERATE EXIT SQL SCRIPT ###\n" | tee -a "${LOGFILE}" +### MAIN ### +# generate exit database +echo "${INFO}Begin: $(date)" | tee -a "${LOGFILE}" +echo -e "${INFO}Generating SQLite Exit Database." | tee -a "${LOGFILE}" perl "${EXIT_PERL}" "${EXIT_DB}" "${MOUNTPOINT}" 2>> "${LOGFILE}" -[[ $? -ne 0 ]] && echo "ERROR: Couldn't create SQLite database, exiting." && exit 10 -date | tee -a "${LOGFILE}" +[[ $? -ne 0 ]] && echo "${ERROR} Couldn't create SQLite Exit Database, exiting." | tee -a "${LOGFILE}" && exit 10 +echo "${INFO}End: $(date)" | tee -a "${LOGFILE}" exit 0