Changeset 32755


Ignore:
Timestamp:
2019-02-07T20:14:03+13:00 (5 years 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)

Location:
other-projects/the-macronizer/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • other-projects/the-macronizer/trunk/build.xml

    r32754 r32755  
    9595    <!-- For the MacroniserFileLogProcessor, which sets up a nightly cron to send useful logging info
    9696     from the daily macron.log.<date> files to a mysqldb, need to do some setup too -->
    97     <copy file="${build.dir.exp}/mysql.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/mysql.properties" filtering="true" overwrite="true"/>
     97    <copy file="${build.dir.exp}/mysql.properties.in" tofile="${basedir}/mysql.properties" filtering="true" overwrite="true"/>
    9898   
    9999    <mkdir dir="${logfileproc.dir}"/>
     
    107107    <filter token="jarlibs.folder" value="${build.dir.exp}/WEB-INF/lib"/>
    108108    <filter token="classes.folder" value="${build.dir.exp}/WEB-INF/classes"/>
     109    <!-- Why can't we set the classpath to the mysql.properties file
     110     to be anywhere other than the toplevel Macronizer folder/basedir?
     111     Anything else causes class MySQLAccess of MacroniserLogFileProcessor
     112     to fail with mysql.properties FileNotFoundException -->
     113    <!--<filter token="mysqlprops.dir" value="${logfileproc.dir}"/>-->
     114    <filter token="mysqlprops.dir" value="${basedir}"/>
    109115   
    110116    <copy file="${scripts.dir}/macronLogToDB.bash.in" tofile="${scripts.dir}/macronLogToDB.bash" filtering="true" overwrite="true"/>
  • other-projects/the-macronizer/trunk/src/java/util/MySQLAccess.java

    r32749 r32755  
    6060    private String PASSWORD; //= "pinky";
    6161
    62     private final String PROPS_FILENAME = "classes/mysql.properties"; // set to "classes/mysql.properties" for IntelliJ
     62    private final String PROPS_FILENAME = "mysql.properties"; // set to "classes/mysql.properties" for IntelliJ
    6363
    6464    //Makes a connection to the server
  • other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in

    r32753 r32755  
    2222# m h  dom mon dow   command
    2323
     24## Cronjob: https://stackoverflow.com/questions/8938120/how-to-run-cron-once-daily-at-10pm
    2425## Send to /dev/null if you want anything in stdout to disappear
    2526## (stderr will go to a daily file called macronLogToDB.err)
  • 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=[email protected] #[email protected]
     8email_address=TYPE_NOTIFICATION_EMAIL
    99
    1010
    11 #macronLogToDBjar=
    1211[email protected]_folder@ #macronizer/web/classes (containing util.MacroniserLogFileProcessor)
    1312[email protected]@ #macronizer/web/logs
     
    1615[email protected]@/macronLogToDB.err #/macronizer/logproc/macronLogToDB.err
    1716[email protected]@ #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
  • other-projects/the-macronizer/trunk/web/mysql.properties.in

    r32750 r32755  
    11# username will be assumed to be root if not specified
    22db.username=root
    3 db.password=CHANGEME
     3db.password=6reenstone3
Note: See TracChangeset for help on using the changeset viewer.