Show
Ignore:
Timestamp:
07.02.2019 20:14:03 (17 months ago)
Author:
ak19
Message:

Western Wilson stuff. Final changes to get the mysql.props file running directly off the-macronizer checkout after ant's been run on it (and the 'ant logs-to-db-instructions' have been followed)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash.in

    r32753 r32755  
    66# Set email_address only if you have permissions to run the mail client 
    77# on your linux box 
    8 email_address=wilsonw9378@gmail.com #tetaka1@gmail.com 
     8email_address=TYPE_NOTIFICATION_EMAIL 
    99 
    1010 
    11 #macronLogToDBjar= 
    1211exec_folder=@logfileproc.exec_folder@ #macronizer/web/classes (containing util.MacroniserLogFileProcessor) 
    1312macronlogs_folder=@macronizer.logs@ #macronizer/web/logs 
     
    1615errfile=@logfileproc.dir@/macronLogToDB.err #/macronizer/logproc/macronLogToDB.err 
    1716jars_folder=@jarlibs.folder@ #macronizer/web/WEB-INF/lib 
    18 mysqlprops_folder=@classes.folder@ #/macronizer/web/WEB-INF/classes 
     17mysqlprops_folder=@mysqlprops.dir@ #why doesn't @logfileproc.dir@ or /macronizer/web/WEB-INF/classes work? and only the basedir of the Macronizer? 
    1918 
    2019echo "" 
     
    3837# "Bash does carry out filename expansion [1] -- a process known as globbing" 
    3938# https://www.tldp.org/LDP/abs/html/globbingref.html 
     39# May be important: https://unix.stackexchange.com/questions/264926/is-it-a-sane-approach-to-back-up-the-ifs-variable 
    4040IFS="$(printf '\n\t')"   # Remove space. 
    4141 
     
    4949 
    5050      echo "Running command:" 
    51       echo "   java -cp .:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder util.MacroniserLogFileProcessor $logfile 2>> $errfile" 
     51      echo "   java -cp \".:$mysqlprops_folder:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder\" util.MacroniserLogFileProcessor $logfile" 
    5252      echo "" 
    53       java -cp .:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder util.MacroniserLogFileProcessor $logfile 2>> $errfile 
    54        
     53      java -cp ".:$mysqlprops_folder:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar" util.MacroniserLogFileProcessor $logfile 
    5554       
    5655      # The above returns 0 on success, -1 on failure 
     
    7069done 
    7170 
    72 IFS="$(printf '\n\t')"   # Remove space. 
    73  
    74 #  Correct glob use: 
    75 #  Always use for-loop, prefix glob, check if exists file. 
    76 #for file in ./macron.log.* ; do         # Use ./* ... NEVER bare * 
    77 #  if [ -e "$file" ] ; then   # Check whether file exists. 
    78 #     echo "$file" 
    79 #  fi 
    80 #done 
    81  
    8271echo "Finished processing macron.log.* files in $macronlogs_folder" 
    8372echo "" 
    8473 
    85 # if email address provided, attempt to send email 
    86 #if [[ -z "${//$email_address }" ]]; then 
    87  
    88 # If error file exists and has non-zero size, send email 
    89 # https://stackoverflow.com/questions/30080997/if-file-is-exists-and-is-not-empty-always-gives-me-the-false-value 
    90  
    91 if [ -s $errfile ] ; then     
    92     # send email with contents of error file 
    93     echo "cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address" 
    94     # TODO: uncomment on a machine that's allowed to email 
    95     #cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address        
     74# if email address provided, attempt to send email there 
     75if [ "$email_address" != "TYPE_NOTIFICATION_EMAIL" ]; then 
    9676     
    97     echo "Supposed to have sent MAIL by now to $email_address" 
     77    # If error file exists and has non-zero size, send email 
     78    # https://stackoverflow.com/questions/30080997/if-file-is-exists-and-is-not-empty-always-gives-me-the-false-value 
     79     
     80    if [ -s $errfile ] ; then     
     81    # send email with contents of error file 
     82    echo "cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address" 
     83    # TODO: uncomment on a machine that's allowed to email 
     84    cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address        
     85     
     86    echo "Supposed to have sent MAIL by now to $email_address" 
     87    fi 
    9888fi 
    99 #fi 
    10089 
    10190 
    102 # Cronjob: https://stackoverflow.com/questions/8938120/how-to-run-cron-once-daily-at-10pm 
    10391 
    104 # In an x-term, on a machine: 
    105 #  
     92 
     93