What creates /var/run/tomcat.pid ?

Latest response

I'm trying to setup Tomcat 8. RHEL 7 has Tomcat 7 (yum install tomcat). I copied the Tomcat 7 scripts in order to make by own Tomcat 8 versions. Everything works fine except for creating my /var/run/tomcat8.pid file. It is a permissions issue, of course. If I change the location for my tomcat8.pid file, my Tomcat 8 service works perfect. But I wanted to have this file in /var/run like it was intended.

I initially thought the service scripts were creating the pid file but when I look at the Tomcat 7 service after I boot up, the service is not started and it's not even enabled. But when I boot my server up, the tomcat.pid file gets created. I even deleted it and then rebooted to make sure. So it seems that something other than the service scripts is creating the file?

/usr/lib/systemd/system/tomcat.service
/usr/sbin/tomcat
/usr/sbin/tomcat-sysd

I'm trying to find out what creates it so I can do the same thing to create my tomcat8.pid file.

Thanks!
Neil

Responses

Hey Neil - I don't have access to a RHEL 7 box at the moment... so this is a very quick suggestion (using a RHEL 5 Satellite host as an example)

# grep -ri tomcat5.pid /etc
/etc/sysconfig/tomcat5:CATALINA_PID=/var/run/tomcat5.pid
# yum whatprovides /var/run/tomcat5.pid

I dont' actually expect the yum command to return anything.. and the pid might be created using a variable in a script (like /var/run/${TOMCAT_BIN}.pid

perhaps

grep -ri tomcat /etc/ | grep pid

Here's the answer. This file is what creates the pid file on bootup.

cat /usr/lib/tmpfiles.d/tomcat.conf
f /var/run/tomcat.pid 0644 tomcat tomcat -

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.