Index: /other-projects/the-macronizer/trunk/build.xml
===================================================================
--- /other-projects/the-macronizer/trunk/build.xml	(revision 32752)
+++ /other-projects/the-macronizer/trunk/build.xml	(revision 32753)
@@ -19,5 +19,7 @@
   <property name="lib.dir.exp"  location="web/WEB-INF/lib" />
   <property name="webinf.dir"  location="web/WEB-INF" />
-  <property name="scripts.dir" location="src/scripts-and-sql" />
+  <!-- Properties for MacroniserLogFileProcessor, use FULL PATHS -->
+  <property name="scripts.dir" location="${basedir}/src/scripts-and-sql" />
+  <property name="logfileproc.dir" value="${basedir}/logproc"/>
   
   <!--
@@ -94,8 +96,18 @@
 	 from the daily macron.log.<date> files to a mysqldb, need to do some setup too -->
     <copy file="${build.dir.exp}/mysql.properties.in" tofile="${build.dir.exp}/WEB-INF/classes/mysql.properties" filtering="true" overwrite="true"/>
-    <chmod file="${scripts.dir}/macronLogToDB.bash" perm="ugo+rx"/>
+    
+    <mkdir dir="${logfileproc.dir}"/>
+    
     <filter token="macronizer.scripts" value="${scripts.dir}"/>
     <filter token="macronizer.logs" value="${build.dir.exp}/logs"/>
     <copy file="${basedir}/src/scripts-and-sql/cron.in" tofile="${basedir}/src/scripts-and-sql/cron.txt" filtering="true" overwrite="true"/>
+
+    <filter token="logfileproc.exec_folder" value="${build.dir.exp}/WEB-INF/classes"/> <!-- where the util.MacroniserLogProcessor compiled code is -->
+    <filter token="logfileproc.dir" value="${logfileproc.dir}"/>
+    <filter token="jarlibs.folder" value="${build.dir.exp}/WEB-INF/lib"/>
+    <filter token="classes.folder" value="${build.dir.exp}/WEB-INF/classes"/>
+    
+    <copy file="${scripts.dir}/macronLogToDB.bash.in" tofile="${scripts.dir}/macronLogToDB.bash" filtering="true" overwrite="true"/>
+    <chmod file="${scripts.dir}/macronLogToDB.bash" perm="ugo+rx"/>
     
     <echo>*** Run the target 'logs-to-db-instructions' for instructions on setting up the MacroniserLogFileProcessor***</echo>
@@ -130,4 +142,12 @@
 	- type 'crontab -e' and the editor will open the cronfile
 	- append the contents from ${scripts.dir}/cron.txt to the cronfile
+	- save file and exit the editor
+
+      5. If you have email rights on the linux you're working from,
+         type your email into macronLogToDB.bash.in and macronLogToDB.bash
+         to get sent emails on errors.
+
+      6. All going well, you should get output files in the ${logfileproc.dir}
+	 folder after the cron job runs each night.
 	
       ************************************************************
Index: /other-projects/the-macronizer/trunk/src/scripts-and-sql/EXAMPLE_INSERT.sql
===================================================================
--- /other-projects/the-macronizer/trunk/src/scripts-and-sql/EXAMPLE_INSERT.sql	(revision 32753)
+++ /other-projects/the-macronizer/trunk/src/scripts-and-sql/EXAMPLE_INSERT.sql	(revision 32753)
@@ -0,0 +1,22 @@
+SET names utf8mb4;
+
+USE Macroniser;
+
+INSERT INTO MarkedWords (marked_word) VALUES
+    ('dÅg'),('lÄx'),('whÄle'),('Åstrich');
+    
+INSERT INTO EntryDates (entry_date) VALUES
+    ('2018-01-01'),('2018-02-02'),('2018-03-03'),('2018-04-04');
+    
+INSERT INTO EntryTimes (entry_time) VALUES
+    ('09:00:09'),('10:10:10'),('21:11:11'),('23:23:23');
+    
+INSERT INTO Occurrences (word_id, time_id, date_id) VALUES
+    (1, 1, 1), (2, 2, 2), (3, 3, 3), (1, 4, 1), (4, 4, 4);
+    
+    
+Select o.occurrence_id, mw.marked_word, ed.entry_date, et.entry_time
+FROM Occurrences o, MarkedWords mw, EntryDates ed, EntryTimes et
+WHERE o.word_id = mw.word_id
+AND o.date_id = ed.date_id
+AND o.time_id = et.time_id;
Index: her-projects/the-macronizer/trunk/src/scripts-and-sql/INSERT.sql
===================================================================
--- /other-projects/the-macronizer/trunk/src/scripts-and-sql/INSERT.sql	(revision 32752)
+++ 	(revision )
@@ -1,22 +1,0 @@
-SET names utf8mb4;
-
-USE Macroniser;
-
-INSERT INTO MarkedWords (marked_word) VALUES
-    ('dÅg'),('lÄx'),('whÄle'),('Åstrich');
-    
-INSERT INTO EntryDates (entry_date) VALUES
-    ('2018-01-01'),('2018-02-02'),('2018-03-03'),('2018-04-04');
-    
-INSERT INTO EntryTimes (entry_time) VALUES
-    ('09:00:09'),('10:10:10'),('21:11:11'),('23:23:23');
-    
-INSERT INTO Occurrences (word_id, time_id, date_id) VALUES
-    (1, 1, 1), (2, 2, 2), (3, 3, 3), (1, 4, 1), (4, 4, 4);
-    
-    
-Select o.occurrence_id, mw.marked_word, ed.entry_date, et.entry_time
-FROM Occurrences o, MarkedWords mw, EntryDates ed, EntryTimes et
-WHERE o.word_id = mw.word_id
-AND o.date_id = ed.date_id
-AND o.time_id = et.time_id;
Index: /other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in
===================================================================
--- /other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in	(revision 32752)
+++ /other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in	(revision 32753)
@@ -27,4 +27,4 @@
 
 ## Stdout goes to the .out file and stderr will go to macronLogToDB..err file
-* 0 * * * @macronizer.scripts@/macronLogToDB.out > @macronizer.logs@/macronLogToDB.out
+* 0 * * * @macronizer.scripts@/macronLogToDB.bash > @logfileproc.dir@/macronLogToDB.out
 
Index: her-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash
===================================================================
--- /other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash	(revision 32752)
+++ 	(revision )
@@ -1,111 +1,0 @@
-#! /bin/bash
-
-
-##the working directory, change this if you in diff place
-#file_dir='/home/wjkw1/RESEARCH_2018-19/bash_test/'
-
-##names of the files
-#jar_filename='testing_jar.jar'
-#log_filename='loggingtest.log'
-
-##log file and jar file compilation
-#jar_file=$file_dir$jar_filename
-#log_file=$file_dir$log_filename
-
-#echo "Executing... $jar_filename"
-#java -jar $jar_file $log_file
-#echo "Finished executing $jar_filename"
-
-###################################
-macronlogs_folder=/home/wjkw1/comp520/MacroniserLogs/tmp #/home/wjkw1/comp520/MacroniserLogs/logs #/Scratch/wjkw1/macron-restoration/web/logs
-#macronLogToDBjar=
-exec_folder=/home/wjkw1/IdeaProjects/LogFileExtraction/out/production/LogFileExtraction
-processed_folder=/Scratch/wjkw1/processed #/Scratch/wjkw1/macron-restoration/processed
-reprocess_folder=/Scratch/wjkw1/reprocess #/Scratch/wjkw1/macron-restoration/reprocess
-errfile=/Scratch/wjkw1/macronLogToDB.err #/Scratch/wjkw1/macron-restoration/macronLogToDB.err
-email_address=wilsonw9378@gmail.com #tetaka1@gmail.com
-jars_folder=/Scratch/wjkw1/mysql-connector-java-8.0.14 #/Scratch/wjkw1/macron-restoration/web/WEB-INF/lib
-mysqlprops_folder=/Scratch/wjkw1/classes #/Scratch/wjkw1/macron-restoration/web/WEB-INF/classes
-
-echo ""
-echo "In script $0 to process macron.log.* files"
-echo "  Note that any logfile named exactly 'macron.log' (instead of matching macron.log.*) will not be processed"
-
-# get rid of any old error files
-if [ -e $errfile ] ; then
-    rm $errfile
-fi
-
-if [ ! -d $macronlogs_folder ] ; then
-    echo "$macronlogs_folder does not exist. Terminating script $0." >> $errfile
-fi
-
-# create these directories iff they don't exist
-mkdir -p $processed_folder
-mkdir -p $reprocess_folder
-
-
-# "Bash does carry out filename expansion [1] -- a process known as globbing"
-# https://www.tldp.org/LDP/abs/html/globbingref.html
-IFS="$(printf '\n\t')"   # Remove space.
-
-#  Correct glob use:
-#  Always use for-loop, prefix glob, check if exists file.
-for logfile in $macronlogs_folder/macron.log.* ; do         # Use ./* ... NEVER bare * [EDIT: if in current folder?]
-    if [ -e "$logfile" ] ; then   # Check whether file exists.
-      echo "****** processing $logfile"      
-
-      # https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-file
-
-      echo "Running command:"
-      echo "   java -cp .:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder util.MacroniserLogFileProcessor $logfile 2>> $errfile"
-      echo ""
-      java -cp .:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder util.MacroniserLogFileProcessor $logfile 2>> $errfile
-      
-      
-      # The above returns 0 on success, -1 on failure
-      # if 0, then move $logfile to processed_folder
-      # and if -1, move to reprocess_folder
-      # https://askubuntu.com/questions/324423/how-to-access-the-last-return-value-in-bash
-      # https://www.tldp.org/LDP/abs/html/comparison-ops.html
-      result=$?
-      if [ "$result" -eq "0" ]; then
-	  echo "Done processing $logfile, moving to $processed_folder"
-	  mv $logfile "$processed_folder/."
-      else
-	  echo "Need to reprocess $logfile, moving to $reprocess_folder" >> $errfile
-	  mv $logfile "$reprocess_folder/."
-      fi
-  fi
-done
-
-IFS="$(printf '\n\t')"   # Remove space.
-
-#  Correct glob use:
-#  Always use for-loop, prefix glob, check if exists file.
-#for file in ./macron.log.* ; do         # Use ./* ... NEVER bare *
-#  if [ -e "$file" ] ; then   # Check whether file exists.
-#     echo "$file"
-#  fi
-#done
-
-echo "Finished processing macron.log.* files"
-echo ""
-
-# If error file exists and has non-zero size, send email
-# https://stackoverflow.com/questions/30080997/if-file-is-exists-and-is-not-empty-always-gives-me-the-false-value
-if [ -s $errfile ] ; then    
-    # send email with contents of error file
-    echo "cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address"
-    # TODO: uncomment on a machine that's allowed to email
-    #cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address
-
-    
-    #echo "Supposed to have sent MAIL by now."
-fi
-
-
-# Cronjob: https://stackoverflow.com/questions/8938120/how-to-run-cron-once-daily-at-10pm
-
-# In an x-term, on a machine:
-# 
Index: /other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash.in
===================================================================
--- /other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash.in	(revision 32753)
+++ /other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash.in	(revision 32753)
@@ -0,0 +1,105 @@
+#! /bin/bash
+
+
+###################################
+
+# Set email_address only if you have permissions to run the mail client
+# on your linux box
+email_address=wilsonw9378@gmail.com #tetaka1@gmail.com
+
+
+#macronLogToDBjar=
+exec_folder=@logfileproc.exec_folder@ #macronizer/web/classes (containing util.MacroniserLogFileProcessor)
+macronlogs_folder=@macronizer.logs@ #macronizer/web/logs
+processed_folder=@logfileproc.dir@/processed #/macronizer/logproc/processed
+reprocess_folder=@logfileproc.dir@/reprocess #/macronizer/logproc/reprocess
+errfile=@logfileproc.dir@/macronLogToDB.err #/macronizer/logproc/macronLogToDB.err
+jars_folder=@jarlibs.folder@ #macronizer/web/WEB-INF/lib
+mysqlprops_folder=@classes.folder@ #/macronizer/web/WEB-INF/classes
+
+echo ""
+echo "In script $0 to process macron.log.* files"
+echo "  Note that any logfile named exactly 'macron.log' (instead of matching macron.log.*) will not be processed"
+
+# get rid of any old error files
+if [ -e $errfile ] ; then
+    rm $errfile
+fi
+
+if [ ! -d $macronlogs_folder ] ; then
+    echo "$macronlogs_folder does not exist. Terminating script $0." >> $errfile
+fi
+
+# create these directories iff they don't exist
+mkdir -p $processed_folder
+mkdir -p $reprocess_folder
+
+
+# "Bash does carry out filename expansion [1] -- a process known as globbing"
+# https://www.tldp.org/LDP/abs/html/globbingref.html
+IFS="$(printf '\n\t')"   # Remove space.
+
+#  Correct glob use:
+#  Always use for-loop, prefix glob, check if exists file.
+for logfile in $macronlogs_folder/macron.log.* ; do         # Use ./* ... NEVER bare * [EDIT: if in current folder?]
+    if [ -e "$logfile" ] ; then   # Check whether file exists.
+      echo "****** processing $logfile"      
+
+      # https://askubuntu.com/questions/625224/how-to-redirect-stderr-to-a-file
+
+      echo "Running command:"
+      echo "   java -cp .:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder util.MacroniserLogFileProcessor $logfile 2>> $errfile"
+      echo ""
+      java -cp .:$exec_folder:$jars_folder/mysql-connector-java-8.0.14.jar:$mysqlprops_folder util.MacroniserLogFileProcessor $logfile 2>> $errfile
+      
+      
+      # The above returns 0 on success, -1 on failure
+      # if 0, then move $logfile to processed_folder
+      # and if -1, move to reprocess_folder
+      # https://askubuntu.com/questions/324423/how-to-access-the-last-return-value-in-bash
+      # https://www.tldp.org/LDP/abs/html/comparison-ops.html
+      result=$?
+      if [ "$result" -eq "0" ]; then
+	  echo "Done processing $logfile, moving to $processed_folder"
+	  mv $logfile "$processed_folder/."
+      else
+	  echo "Need to reprocess $logfile, moving to $reprocess_folder" >> $errfile
+	  mv $logfile "$reprocess_folder/."
+      fi
+  fi
+done
+
+IFS="$(printf '\n\t')"   # Remove space.
+
+#  Correct glob use:
+#  Always use for-loop, prefix glob, check if exists file.
+#for file in ./macron.log.* ; do         # Use ./* ... NEVER bare *
+#  if [ -e "$file" ] ; then   # Check whether file exists.
+#     echo "$file"
+#  fi
+#done
+
+echo "Finished processing macron.log.* files in $macronlogs_folder"
+echo ""
+
+# if email address provided, attempt to send email
+#if [[ -z "${//$email_address }" ]]; then
+
+# If error file exists and has non-zero size, send email
+# https://stackoverflow.com/questions/30080997/if-file-is-exists-and-is-not-empty-always-gives-me-the-false-value
+
+if [ -s $errfile ] ; then    
+    # send email with contents of error file
+    echo "cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address"
+    # TODO: uncomment on a machine that's allowed to email
+    #cat $errfile | mail -s 'Macron.log to DB cron failure output' $email_address       
+    
+    echo "Supposed to have sent MAIL by now to $email_address"
+fi
+#fi
+
+
+# Cronjob: https://stackoverflow.com/questions/8938120/how-to-run-cron-once-daily-at-10pm
+
+# In an x-term, on a machine:
+# 
