Changeset 32751


Ignore:
Timestamp:
2019-02-07T17:16:53+13:00 (5 years ago)
Author:
ak19
Message:

Macroniser ant build file now does more setup for MacronLogFileProcessor and contains a a new target that provides instructions on how to set it up (from the link to installing and running mysql db to setting up the nightly cron)

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

Legend:

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

    r32750 r32751  
    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" />
    2122 
    2223  <!--
     
    8283    <!-- 1. Create the log4j.properties file from its log4j.properties.in template file and put it into the *Macronizer* installation's web/WEB-INF/classes folder -->
    8384    <copy file="${build.dir.exp}/log4j.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/log4j.properties" filtering="true" overwrite="true"/>
    84     <copy file="${build.dir.exp}/mysql.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/mysql.properties" filtering="true" overwrite="true"/>
    8585   
    8686    <!-- 2. Create the macronizer.xml tomcat context file from the macronizer.xml.in template file and put it into the correct location in the associated GS3 installation -->
     
    9090     when necessary. Does nothing if the directory already exist. -->
    9191    <mkdir dir="${build.dir.exp}/logs"/>
     92
     93    <!-- For the MacroniserFileLogProcessor, which sets up a nightly cron to send useful logging info
     94     from the daily macron.log.<date> files to a mysqldb, need to do some setup too -->
     95    <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"/>
     97    <filter token="macronizer.scripts" value="${scripts.dir}"/>
     98    <filter token="macronizer.logs" value="${build.dir.exp}/logs"/>
     99    <copy file="${basedir}/src/scripts-and-sql/cron.in" tofile="${basedir}/src/scripts-and-sql/cron.txt" filtering="true" overwrite="true"/>
     100   
     101    <echo>Run the target 'logs-to-db-instructions' for instructions on setting up the MacroniserLogFileProcessor</echo>
    92102  </target>
    93103
     104  <target name="logs-to-db-instructions">
     105    <echo>************************************************************
     106      Instructions on setting up the MacroniserLogFileProcessor
     107      ************************************************************
     108     
     109      1. Install mysql-5.7.23 as instructed at http://wiki.greenstone.org/doku.php?id=en:user_advanced:greenstonesqlplugs#getting_and_running_mysql
     110      (And when you run that mysql installation's db server, shut it down or run its mysql client, do so as per the instructions there)
     111
     112      2. Use separate terminals to use the above instructions link to:
     113        - Start the mysql server
     114        - Connect to the mysql client
     115     
     116      3. After connecting to the client, in the mysql client terminal
     117        - IMPORTANT: don't forget to immediately follow with 'set names utf8mb4;'
     118        - CREATE AND INITIALISE the Macroniser database and its tables by running the MySQL_Code.sql script by typing the following and hitting ENTER: 
     119            source ${scripts.dir}/MySQL_Code.sql
     120     
     121      3. Edit ${build.dir.exp}/WEB-INF/classes/mysql.properties to set the db password.
     122        - If you set up a different username for the mysql db, set that in mysql.properties too.
     123        - If nothing is set, MacronLogFileProcessor will assume the username is root.   
     124
     125      4. Set up the daily cronjob as follows:
     126        - open a terminal and type 'export EDITOR=emacs' (or set to the text editor you prefer)
     127    - type 'crontab -e' and the editor will open the cronfile
     128    - append the contents from ${scripts.dir}/cron.txt to the cronfile
    94129   
     130      ************************************************************
     131    </echo>
     132  </target>
     133 
    95134  <target name="war" depends="build">
    96135    <echo>Basedir: ${basedir}</echo>
  • other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in

    r32750 r32751  
    2222# m h  dom mon dow   command
    2323
    24 #* 0 * * * /PATH/TO/macronLogToDB.bash > /dev/null
     24## Send to /dev/null if you want anything in stdout to disappear
     25## (stderr will go to a daily file called macronLogToDB.err)
     26#* 0 * * * @macronizer.scripts@/macronLogToDB.bash > /dev/null
    2527
    26 ## Stdout goes to the .out file and stderr will go to an .err file
    27 * 0 * * * /PATH/TO/macronLogToDB.bash > /PATH/TO/macronLogToDB.out
     28## Stdout goes to the .out file and stderr will go to macronLogToDB..err file
     29* 0 * * * @macronizer.scripts@/macronLogToDB.out > @macronizer.logs@/macronLogToDB.out
    2830
Note: See TracChangeset for help on using the changeset viewer.