Changeset 32753


Ignore:
Timestamp:
2019-02-07T19:12:06+13:00 (5 years ago)
Author:
ak19
Message:

Western Wilson stuff. Automating MacroniserLogFileProcessor setup from the build.xml

Location:
other-projects/the-macronizer/trunk
Files:
2 edited
2 moved

Legend:

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

    r32752 r32753  
    1919  <property name="lib.dir.exp"  location="web/WEB-INF/lib" />
    2020  <property name="webinf.dir"  location="web/WEB-INF" />
    21   <property name="scripts.dir" location="src/scripts-and-sql" />
     21  <!-- Properties for MacroniserLogFileProcessor, use FULL PATHS -->
     22  <property name="scripts.dir" location="${basedir}/src/scripts-and-sql" />
     23  <property name="logfileproc.dir" value="${basedir}/logproc"/>
    2224 
    2325  <!--
     
    9496     from the daily macron.log.<date> files to a mysqldb, need to do some setup too -->
    9597    <copy file="${build.dir.exp}/mysql.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/mysql.properties" filtering="true" overwrite="true"/>
    96     <chmod file="${scripts.dir}/macronLogToDB.bash" perm="ugo+rx"/>
     98   
     99    <mkdir dir="${logfileproc.dir}"/>
     100   
    97101    <filter token="macronizer.scripts" value="${scripts.dir}"/>
    98102    <filter token="macronizer.logs" value="${build.dir.exp}/logs"/>
    99103    <copy file="${basedir}/src/scripts-and-sql/cron.in" tofile="${basedir}/src/scripts-and-sql/cron.txt" filtering="true" overwrite="true"/>
     104
     105    <filter token="logfileproc.exec_folder" value="${build.dir.exp}/WEB-INF/classes"/> <!-- where the util.MacroniserLogProcessor compiled code is -->
     106    <filter token="logfileproc.dir" value="${logfileproc.dir}"/>
     107    <filter token="jarlibs.folder" value="${build.dir.exp}/WEB-INF/lib"/>
     108    <filter token="classes.folder" value="${build.dir.exp}/WEB-INF/classes"/>
     109   
     110    <copy file="${scripts.dir}/macronLogToDB.bash.in" tofile="${scripts.dir}/macronLogToDB.bash" filtering="true" overwrite="true"/>
     111    <chmod file="${scripts.dir}/macronLogToDB.bash" perm="ugo+rx"/>
    100112   
    101113    <echo>*** Run the target 'logs-to-db-instructions' for instructions on setting up the MacroniserLogFileProcessor***</echo>
     
    130142    - type 'crontab -e' and the editor will open the cronfile
    131143    - append the contents from ${scripts.dir}/cron.txt to the cronfile
     144    - save file and exit the editor
     145
     146      5. If you have email rights on the linux you're working from,
     147         type your email into macronLogToDB.bash.in and macronLogToDB.bash
     148         to get sent emails on errors.
     149
     150      6. All going well, you should get output files in the ${logfileproc.dir}
     151     folder after the cron job runs each night.
    132152   
    133153      ************************************************************
  • other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in

    r32751 r32753  
    2727
    2828## Stdout goes to the .out file and stderr will go to macronLogToDB..err file
    29 * 0 * * * @macronizer.scripts@/macronLogToDB.out > @macronizer.logs@/macronLogToDB.out
     29* 0 * * * @macronizer.scripts@/macronLogToDB.bash > @logfileproc.dir@/macronLogToDB.out
    3030
  • other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash.in

    r32752 r32753  
    22
    33
    4 ##the working directory, change this if you in diff place
    5 #file_dir='/home/wjkw1/RESEARCH_2018-19/bash_test/'
     4###################################
    65
    7 ##names of the files
    8 #jar_filename='testing_jar.jar'
    9 #log_filename='loggingtest.log'
     6# Set email_address only if you have permissions to run the mail client
     7# on your linux box
     8[email protected] #[email protected]
    109
    11 ##log file and jar file compilation
    12 #jar_file=$file_dir$jar_filename
    13 #log_file=$file_dir$log_filename
    1410
    15 #echo "Executing... $jar_filename"
    16 #java -jar $jar_file $log_file
    17 #echo "Finished executing $jar_filename"
    18 
    19 ###################################
    20 macronlogs_folder=/home/wjkw1/comp520/MacroniserLogs/tmp #/home/wjkw1/comp520/MacroniserLogs/logs #/Scratch/wjkw1/macron-restoration/web/logs
    2111#macronLogToDBjar=
    22 exec_folder=/home/wjkw1/IdeaProjects/LogFileExtraction/out/production/LogFileExtraction
    23 processed_folder=/Scratch/wjkw1/processed #/Scratch/wjkw1/macron-restoration/processed
    24 reprocess_folder=/Scratch/wjkw1/reprocess #/Scratch/wjkw1/macron-restoration/reprocess
    25 errfile=/Scratch/wjkw1/macronLogToDB.err #/Scratch/wjkw1/macron-restoration/macronLogToDB.err
    26 e[email protected] #[email protected]
    27 jars_folder=/Scratch/wjkw1/mysql-connector-java-8.0.14 #/Scratch/wjkw1/macron-restoration/web/WEB-INF/lib
    28 mysqlprops_folder=/Scratch/wjkw1/classes #/Scratch/wjkw1/macron-restoration/web/WEB-INF/classes
     12exec_folder=@logfileproc.exec_folder@ #macronizer/web/classes (containing util.MacroniserLogFileProcessor)
     13[email protected]@ #macronizer/web/logs
     14[email protected]@/processed #/macronizer/logproc/processed
     15[email protected]@/reprocess #/macronizer/logproc/reprocess
     16e[email protected]@/macronLogToDB.err #/macronizer/logproc/macronLogToDB.err
     17jars_folder=@jarlibs.folder@ #macronizer/web/WEB-INF/lib
     18mysqlprops_folder=@classes.folder@ #/macronizer/web/WEB-INF/classes
    2919
    3020echo ""
     
    9080#done
    9181
    92 echo "Finished processing macron.log.* files"
     82echo "Finished processing macron.log.* files in $macronlogs_folder"
    9383echo ""
     84
     85# if email address provided, attempt to send email
     86#if [[ -z "${//$email_address }" ]]; then
    9487
    9588# If error file exists and has non-zero size, send email
    9689# https://stackoverflow.com/questions/30080997/if-file-is-exists-and-is-not-empty-always-gives-me-the-false-value
     90
    9791if [ -s $errfile ] ; then   
    9892    # send email with contents of error file
    9993    echo "cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address"
    10094    # TODO: uncomment on a machine that's allowed to email
    101     #cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address
    102 
     95    #cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address       
    10396   
    104     #echo "Supposed to have sent MAIL by now."
     97    echo "Supposed to have sent MAIL by now to $email_address"
    10598fi
     99#fi
    106100
    107101
Note: See TracChangeset for help on using the changeset viewer.