Skip to content
Snippets Groups Projects
Commit 45f0b6b9 authored by Jörg Sachse's avatar Jörg Sachse
Browse files

fix: unify info/error messages (labels, color, log redirection), fix missing...

fix: unify info/error messages (labels, color, log redirection), fix missing declaration of LOGFILE var
parent eed98e2b
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment