Changeset 32755
- Timestamp:
- 2019-02-07T20:14:03+13:00 (5 years ago)
- Location:
- other-projects/the-macronizer/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/the-macronizer/trunk/build.xml
r32754 r32755 95 95 <!-- For the MacroniserFileLogProcessor, which sets up a nightly cron to send useful logging info 96 96 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="${b uild.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"/> 98 98 99 99 <mkdir dir="${logfileproc.dir}"/> … … 107 107 <filter token="jarlibs.folder" value="${build.dir.exp}/WEB-INF/lib"/> 108 108 <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}"/> 109 115 110 116 <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 60 60 private String PASSWORD; //= "pinky"; 61 61 62 private final String PROPS_FILENAME = " classes/mysql.properties"; // set to "classes/mysql.properties" for IntelliJ62 private final String PROPS_FILENAME = "mysql.properties"; // set to "classes/mysql.properties" for IntelliJ 63 63 64 64 //Makes a connection to the server -
other-projects/the-macronizer/trunk/src/scripts-and-sql/cron.in
r32753 r32755 22 22 # m h dom mon dow command 23 23 24 ## Cronjob: https://stackoverflow.com/questions/8938120/how-to-run-cron-once-daily-at-10pm 24 25 ## Send to /dev/null if you want anything in stdout to disappear 25 26 ## (stderr will go to a daily file called macronLogToDB.err) -
other-projects/the-macronizer/trunk/src/scripts-and-sql/macronLogToDB.bash.in
r32753 r32755 6 6 # Set email_address only if you have permissions to run the mail client 7 7 # on your linux box 8 email_address= [email protected] #[email protected]8 email_address=TYPE_NOTIFICATION_EMAIL 9 9 10 10 11 #macronLogToDBjar=12 11 [email protected]_folder@ #macronizer/web/classes (containing util.MacroniserLogFileProcessor) 13 12 [email protected]@ #macronizer/web/logs … … 16 15 [email protected]@/macronLogToDB.err #/macronizer/logproc/macronLogToDB.err 17 16 [email protected]@ #macronizer/web/WEB-INF/lib 18 mysqlprops_folder=@ classes.folder@ #/macronizer/web/WEB-INF/classes17 mysqlprops_folder=@mysqlprops.dir@ #why doesn't @logfileproc.dir@ or /macronizer/web/WEB-INF/classes work? and only the basedir of the Macronizer? 19 18 20 19 echo "" … … 38 37 # "Bash does carry out filename expansion [1] -- a process known as globbing" 39 38 # 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 40 40 IFS="$(printf '\n\t')" # Remove space. 41 41 … … 49 49 50 50 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" 52 52 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 55 54 56 55 # The above returns 0 on success, -1 on failure … … 70 69 done 71 70 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 # fi80 #done81 82 71 echo "Finished processing macron.log.* files in $macronlogs_folder" 83 72 echo "" 84 73 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 75 if [ "$email_address" != "TYPE_NOTIFICATION_EMAIL" ]; then 96 76 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 98 88 fi 99 #fi100 89 101 90 102 # Cronjob: https://stackoverflow.com/questions/8938120/how-to-run-cron-once-daily-at-10pm103 91 104 # In an x-term, on a machine: 105 # 92 93 -
other-projects/the-macronizer/trunk/web/mysql.properties.in
r32750 r32755 1 1 # username will be assumed to be root if not specified 2 2 db.username=root 3 db.password= CHANGEME3 db.password=6reenstone3
Note:
See TracChangeset
for help on using the changeset viewer.