Question
TDI System Service CO.,LTD.
JP
Last activity: 26 Dec 2023 9:51 EST
About setting to automatically start tomcat service after OS startup
I am planning to configure tomcat service to start automatically when a VM on Cloud starts. Target servers are pega application server and pega batch server. I want to change the settings to automatically start the tomcat service using systemd.
OS:RHEL 8.1
Please tell me about the following questions.
1.Where is the directory to place the unit file? (/usr/lib/systemd/system/tomcat.service) Is it correct?
2.Are the Unit file settings as follows?
[Unit] Description=Tomcat Service After=syslog.target network.target
[Service] Type=forking PIDFile=/pega/tomcat/tomcatPIDs.txt Environment=JAVA_HOME=/pega/java Environment=CATALINA_HOME=/pega/tomcat Environment=CATALINA_PID=/pega/tomcat/tomcatPIDs.txt Environment=BASEDIR=$CATALINA_HOME Environment=TOMCAT_USER=pegaadm Environment=JAVA_OPTS="-Xms4096m -Xmx8192m" Environment=LD_LIBRARY_PATH=$CATALINA_HOME ExecStartPre=/usr/bin/rm -f /pega/tomcat/tomcatPIDs.txt ExecStart=su - $TOMCAT_USER -c "LD_LIBRARY_PATH=$CATALINA_HOME;export LD_LIBRARY_PATH;CATALINA_PID=/pega/tomcat/tomcatPIDs.txt;export CATALINA_PID;$CATALINA_HOME/bin/startup.sh -force" ExecStop=su - $TOMCAT_USER -c "CATALINA_PID=/pega/tomcat/tomcatPIDs.txt;export CATALINA_PID;$CATALINA_HOME/bin/shutdown.sh 30 -force" Restart=no
[Install] WantedBy=multi-user.target