#!/bin/bash
#
#########################################################################################
# Script: abs_config.sh
# Description: settings for abs.sh management script
# ABS Laundry Business Solutions/ROP/RAY
#### Changelog ##########################################################################
# 1.0, 		20090209 - Initial version
# 1.1, 		20101008 - Added logrotation settings
# 1.2, 		20110509 - Added wide slotnumbers
# 3.2, 		20130930 - Remove Tomcat
# 4.10,		20170807 - Add Java 1.8_131 for JAVA8_131_HOME
# 5.3, 		20190306 - Added GFSTARTUPSNMPCHECK/GFSNMPMAXAPPSTARTTIME for Glassfish SNMP check on complete slot startup
# 6.0,		20240212 - Support for Glassfish4, Payara5, Tomee8, Tomee91, Tomcat90 and Tomcat9
# 9.08.00,	20240403 - Renamed version
# 9.08.01,  20240425 - Added Support for Tomcat9 - ABS-164468
# 9.08.01,  20240821 - TI changes for replacing TomEE with Tomcat in 9.08.00 - ABS-167946
# 9.09.00,  20241104 - Absmenu update supporting Java21 for ABSSolute 9.09.00 - ABS-170835
# 9.09.02,  20250601 - ABSSolute Server - Standardization & hot redeploy - TS-839
# 9.09.02,  20251210 - Java 17 minor version update to Vestis - TS-1955
#########################################################################################

#### Settings / parameters / variables that might need changing #########################
ABSHOST="tomcat1.abssolute.net"    	# IP-address or DNS name of the physical server machine

APPSRVMAXMEM="512m"             	# default/maximum memory (heapspace) given to application server
REPSRVMAXMEM="512m"             	# default/maximum memory (heapspace) given to report server
TOMEEMAXMEM="384m"              	# default Tomee MaxMem (384m standard)
TOMEE8MAXMEM="384m"              	# default Tomee8 MaxMem (384m standard)
TOMEE91MAXMEM="384m"              	# detfault Tomee91 MaxMem (384m standard)
TOMCAT90MAXMEM="384m"              	# default Tomcat90 MaxMem (384m standard)
TOMCAT9MAXMEM="384m"              	# default Tomcat9 MaxMem (384m standard)
TOMCAT10MAXMEM="384m"              	# default Tomcat10 MaxMem (384m standard)
APPMAXPERM="384m"               	# default AppSrv MaxPermGen (384m standard)
REPMAXPERM="384m"               	# default RepSrv MaxPermGen (384m standard)
GFMAXPERM="384m"                	# default Glassfish MaxPermGen (384m standard)
TCMAXPERM="384m"	       		# default Tomee MaxPermGen (384m standard)
TCPROTOCOL="https"

SLOTPOS=2                       	# length (in chars) of a slotnumber.  i.e. 1 --> 1..9, 2 --> 01..99, 3 --> 001..999
MIN_SLOT=01                    		# min slot number that can be selected
MAX_SLOT=99                    		# max slot number that can be selected

DELAYAFTERSTART=15              	# wait this amount of seconds after starting java as daemon
					# or starting/stopping glassfish. Changed by using option -y

GFSTARTUPSNMPCHECK=Y            	# Check app. service SNMP code during startup of Glassfish.
TCSTARTUPSNMPCHECK=Y            	# Check app. service SNMP code during startup of Tomee/Tomcat.
GFSNMPMAXAPPSTARTTIME=15        	# Minutes after app service should give a valid SNMP status. In case of a timeout Glassfish will attempt a startup.

# JMX Debugging
ENABLE_REMOTE_JMX_MONITORING=Y		# Enable Java JMX Monitoring for debug purpose: app, rep and web servers; default is N (Values: Y/N)

#### Web Server settings        	###################################################################################################################
GFONLY=N                        	# Y = server ONLY holds glassfish, N = app/rep also present on the server
GFDOMAIN=production             	# default glassfish domain name
#GLASSFISHPATH="glassfish4"   		# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 90103
GLASSFISHPATH="payara5"		    	# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 90400
TOMEE8FOLDERNAME="tomee8"		# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 90700,90701,90702,90703,90704
TOMEEFOLDERNAME="tomee91"	    	# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 90800
TOMCATFOLDERNAME="tomcat90"	    	# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 90800
TOMCAT9FOLDERNAME="tomcat9"	    	# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 9.07.00.RELEASE.p23
TOMCAT10FOLDERNAME="tomcat10"	    	# directory name seen in $ABS_ROOTDIR/$SLOT - for ABSSolute version >= 9.08.01
GLASSADMINUSR=admin		       	# glassfish admin user
TCADMINUSR=admin		       	# tomee/tomcat admin user
GLASSADMINPWD=gfadmin01     		# glassfish admin password
TCADMINPWD=tcadmin01		    	# tomee/tomcat admin password

#Deprecated Web Applications
#WEBPORTALNAME=webportal
#WEBSERVICE2NAME=webservice2
#ABSROUTEASSISTANDNAME=absrouteassistant
#WEBCLIENTMYUNIFORMASSISTANT=webclientmyuniformassistant

#Glassfish(Payara) and Tomee8 - all webapps
#Tomcat90,Tomcat9
GENERICWEBSERVICENAME=absgenericwebservice
MOBILERESTSERVICENAME=absmobilerestservices
WEBRESTSERVICENAME=absrestservices
MOBILEWEBSERVICENAME=absws4mobileapps
#Tomee91,Tomcat10
WEBCLIENTNAME=webclientx
WEBPORTAL2NAME=abswebportal
WEBUHFMONNAME=absuhfmonitor
WEBCLIENTRESIDENTIALDELIVERYNAME=webresidentialdelivery
WEBCLIENTROUTERETURNSNAME=webclientroutereturns
WEBCLIENTREPLACESMARTBARCODENAME=webclientbarcode
MOBILEFIREBASESERVICESNAME=absmobilefirebase
WEBCLIENTCLEANROOMPACKINGINSTRUCTIONSNAME=webclientcleanpacking

# default values. These are used when no commandline options are given
export ABS_ROOTDIR=/abs
ABS_TYPE=all
ABS_CMD=status
ABS_SLOT=1
LISTOPTION="s"

#### Other settings #####################################################################
SLOT_MULT=100                   # multiply slotnr by this number to form the port numbers used for monitoring
APPLOGCONSOLE="yes"             # Set to "yes" if you want to send stdout and stderr of 
                                # a daemonized application server process to a logfile
REPLOGCONSOLE="yes"             # Set to "yes" if you want to send stdout and stderr of 
                                # a daemonized report server process to a logfile
REPDEBUGLOGFILTER="no"          # Set to "yes" if Report server debug information needs
                                # to be filtered, default is "no"                                

# Filter options for REPDEBUGLOGFILTERVALUE:
# "queryStr=report" logs initial report submission at report engine
# "Memory at"       logs report engine memory allocation at specific processing steps
# "SELECT "         logs used full select statement with bind values
# "Data fetched"    logs the time it took to fetch and number of records fetched from the database 
# "Rendered report" logs the time it took to the generate the report from begin to end. (report result sent to client)
REPDEBUGLOGFILTERVALUE="(OutOfMemoryError|Rendered report|SELECT |Memory at|queryStr=report|Data fetched)"

# Set the folowing properties in crystalclear.properties :
# log.engine=true
# log.level=4    (to log heap usage)
# The following log levels will provide the specific detail information:
# 1	Error  ->  -Report render time, the time to query, render result back to the client
# 2	Warn   ->  -Report render time, the time to query, render result back to the client
# 3 Info   ->  -Report render time, the time to query, render result back to the client
#              -Select statement with bind variable values.
# 4	Debug  ->  -Report render time, the time to query, render result back to the client
#              -Select statement with bind variable values
#              -Report server heap grown for at specific actions

# list of resourcefiles used. __homedir__ is replaced by the script with the proper $ABS_HOME + $SLOT
# (since $ABS_HOME + $SLOT is dynamic, this can not be done here)
CP_RESOURCES=__homedir__/Server/Lib/resources.jar
CP_RESOURCES=$CP_RESOURCES:__homedir__/Server/Lib/resources_nl_NL.jar
CP_RESOURCES=$CP_RESOURCES:__homedir__/Server/Lib/resources_da_DK.jar
CP_RESOURCES=$CP_RESOURCES:__homedir__/Server/Lib/resources_de_DE.jar
CP_RESOURCES=$CP_RESOURCES:__homedir__/Server/Lib/resources_fr_FR.jar

#ORACLE_HOME=/abs/oracle/product/19.3.0/client_1
ORACLE_HOME=/abs/oracle/product/19.0.0/client_1
OJDBC_JAR=jdbc/lib/ojdbc8.jar   # Set the correct OJDBC jar file name here. The given path is as seen from $ORACLE_HOME
JDBCLOGFLAG=false               # Set to true to enable jdbc logging. This needs a custom OJDBC jar file.
JAVA6_HOME=/abs/jdk1.6.0_45
JAVA7_HOME=/abs/jdk1.7.0_51
JAVA8_HOME=/abs/jdk1.8.0_60
JAVA8_131_HOME=/abs/jdk1.8.0_131
JAVA11_37_HOME=/abs/zulu11.37.17-ca-jdk11.0.6-linux_x64
JAVA11_60_HOME=/abs/zulu11.60.19-ca-jdk11.0.17-linux_x64
JAVA17_44_HOME=/abs/zulu_17_44_15_0e4a26618b62
JAVA17_60_HOME=/abs/zulu_17_60_17_769a1f364544
JAVA17_62_HOME=/abs/zulu_17_62_17_ba824b3a62f1
JAVA21_38_HOME=/abs/zulu_21_38_21_9e657f56db5a
JAVA21_46_HOME=/abs/zulu_21_46_19_f28ddd12524c
STRACEPATH=/usr/bin
LSOFPATH=/usr/bin
VISUALVM_HOME=$ABS_ROOTDIR/visualvm

#JAVA_TMP_DIR=/tmp
JAVA_TMP_DIR=/abs/tmp

PAGER="less"                    # your favourite textfile viewer. used to read logfile
NOXVFB_CRITICAL="yes"           # no Xvfb --> stop script. Set this to "no" to start anyway on current desktop
LOGWEEKS=2                      # keep 2 weeks of logfiles when making a dump-tar

#### Settings / parameters / variables that normally do not need changing ###############
DOWNSTRING="<down>"
XVFBOFFSET=1                    # Change if Xvfb offset is needed. 1 for :11, :12, :13; 2 for :21, :22, :23 etc
XVFBTAIL=                       # Some versions of X or Xvfb need a .0 here
JMONAPPBASEPORT=50013           # MONITORPORT = BASEPORT + SLOTNR
JMONREPBASEPORT=50023           # MONITORPORT = BASEPORT + SLOTNR
JMONWEBBASEPORT=50033           # MONITORPORT = BASEPORT + SLOTNR
JMONWEBTOMCATBASEPORT=50063     # MONITORPORT = BASEPORT + SLOTNR
JMONWEBTOMCAT9BASEPORT=50063    # MONITORPORT = BASEPORT + SLOTNR - Tomcat9 (88)
JMONWEBTOMCAT10BASEPORT=50033   # MONITORPORT = BASEPORT + SLOTNR - Tomcat10
MONINTERVAL=4                   # jConsole - Seconds between monitoring intervals
MONPLUGINPATH=""                # jConsole - Plugin path
MONNOTILE="yes"                 # jConsole - use option -notile (yes/no)

#### Error recovery / error handling settings ###########################################
# MEMERRHEAPDUMP        on/off. Let the script create a heapdump on out-of-memory situation.
# MEMERRTHREADDUMP      on/off. Let the script create a threaddump on out-of-memory situation
# MEMERRACTION          out of memory action. 
#                       possible values: off, kill or restart meaning do nothing, kill process or restart process
# FATALERRHEAPDUMP      on/off. Let the script create a heapdump on a fatal error situation
# FATALERRTHREADDUMP    on/off. Let the script create a threaddump on a fatal error situation
# FATALERRACTION        fatal error action.
#                       possible values: off, kill or restart meaning do nothing, kill process or restart process
MEMERRHEAPDUMP="on"
MEMERRTHREADDUMP="on"
MEMERRACTION="restart"
FATALERRHEAPDUMP="on"
FATALERRTHREADDUMP="on"
FATALERRACTION="restart"

#### E-mail settings ####################################################################
MAILBINPATH=/usr/bin/nail   # path to the nail executable
SMTPSRV=82.94.92.2          # points to your SMTP server. Comment this line out if
                            # you want to use a local sendmail setup.
EMAILFROM=ABSSolute_Server  # This is the user where the email seems to come from
EMAILDOMAIN=abslbs.com      # This is the domain where the email seems to come from
AUTH_SMTP=no                # set to YES if your SMTP server needs authentication
SMTPUSER=                   # If SMTPUSER and SMTPPWD are set, AND AUTH_SMTP is set
SMTPPWD=                    # to "yes" then these credentials will be used to log 
                            # into the SMTP server. If they are left empty (default)
                            # or SMTP_AUTH is set to "no" then no authentication is done

EMAIL_ON_OOM_FATAL=off      # send emails on out-of-memory and fatal events. on or off
EMAIL_TO_OOM_FATAL='support@abslbs.com'

EMAIL_ON_MAINT=off          # send emails on start/stop/restart/etc of servers. on or off
EMAIL_TO_MAINT='support@abslbs.com'

EMAIL_SEND_SCRIPT_LOG="no"  # attach abs.sh script logfile to the email. yes or no

EMAIL_SEND_ON_STATUS="no"   # send email when command STATUS or -ls or -ln is issued
EMAIL_SEND_ON_START="no"    # send email when command starting a server process
EMAIL_SEND_ON_STOP="no"     # send email when command stopping a server process
EMAIL_SEND_ON_RESTART="no"  # send email when command restarting a server process
EMAIL_SEND_ON_GUI="no"      # send email when command when a GUI is started
EMAIL_SEND_ON_MONITOR="no"  # send email when processes are monitored
EMAIL_SEND_ON_THREAD="no"   # send email when a thread dump is created
EMAIL_SEND_ON_DUMP="no"     # send email when a head dump is created
EMAIL_SEND_ON_LOG="no"      # send email when the logile is shown
EMAIL_SEND_ON_COLLECT="no"  # send email when the logiles are collected in a TAR file

#### Logrotate configuration ############################################################
# This will only work if "/usr/sbin/logrotate -s /abs/log/rotate.state /abs/abslogrotate.conf"
# is added to your crontab using command crontab -e so that is will be called regularly
# example of a valid crontab line for log rotation:
# */10 * * * * /usr/sbin/logrotate -s /abs/log/logrotate.state /abs/abslogrotate.conf
# this will start the rotation tool every 10 minutes.
# Please check on your system where the logrotate executable is kept by using command
# whereis logrotate.  In our case it is in /usr/sbin, but on other distributions it 
# may be located in a different directory. 
#
USELOGROTATE="yes"          # global setting to enable (yes) or disable (no) logrotation. This 
                            # setting is a "master switch" and overrides the LOGROTAPPSRV, 
                            # LOGROTREPSRV and LOGROTREPCC settings
LOGROTAPPSRV="yes"          # enable (yes) or disable (no) rotation of applicationserver logs
LOGROTREPSRV="yes"          # enable (yes) or disable (no) rotation of reportserver logs
LOGROTREPCC="yes"           # enable (yes) or disable (no) rotation of inet CC-logs
LOGROTCONFDIR="logrotate"   # directory in abs_root directory where logrotate configs 
                            # are placed
LOGROTMAXAGE=90             # logs older then 90 days are removed. Set to 0 to disable maxage
LOGROTKEEP=200              # keep 200 (max. 2 days, 4 rotations per hour) old versions 
                            # of the logfile
LOGROTMAXSIZE="10M"         # rotate files if they are bigger then 10MB
#########################################################################################
