2

I have an application written in python which I've used many times with CentOS 6, and am now setting it up on CentOS 7. I've created a systemd service file that contains the following:

#
# Systemd unit file for Application
#

[Unit]
Description=Application Daemon

[Service]
User=svc_app
Group=svc_app

Type=forking
ExecStart=/usr/bin/python /apps/application/run_app.py --daemon --pidfile=/var/run/apps/application.pid
ExecStop=pkill --pidfile /var/run/apps/application.pid
PIDFile=/var/run/apps/application.pid

[Install]
WantedBy=multi-user.target

If I run systemctl start application.service, the app starts. If I run systemctl stop application.service, the app stops. If I run systemctl status application.service, I get the correct status.

However, I'm experiencing two log messages that are concerning, and not sure why I'm getting them.

Jun 10 18:36:43 centos7-test systemd[1]: Starting Application Daemon...
Jun 10 18:36:44 centos7-test systemd[1]: PID file /var/run/apps/application.pid not readable (yet?) after start.
Jun 10 18:36:44 centos7-test systemd[1]: Started Application Daemon.

App starts, but the message application.pid not readable had me concerned. Should I be concerned about this, or can I ignore it? My application is successfully creating a pid file that contains the pid of the running instance, so I know that's working correctly.

Second issue is when I run systemctl stop application.service.

Jun 10 18:49:33 centos7-test systemd[1]: Stopping Application Daemon...
Jun 10 18:49:43 centos7-test systemd[1]: Stopped Application Daemon.
Jun 10 18:49:43 centos7-test systemd[1]: [/etc/systemd/system/application.service:14] Executable path is not absolute, ignoring: pkill --pidfile /var/run/apps/application.pid
Jun 10 18:49:43 centos7-test systemd[1]: [/etc/systemd/system/application.service:14] Executable path is not absolute, ignoring: pkill --pidfile /var/run/apps/application.pid
Jun 10 18:49:54 centos7-test systemd[1]: [/etc/systemd/system/application.service:14] Executable path is not absolute, ignoring: pkill --pidfile /var/run/apps/application.pid

Now the service is dead, pidfile is gone. So it stopped, but those messages concern me. What's going on, or where else can I look? Is there something other than pkill I should use to stop my python app? on CentOS 6 I used killproc, but that doesn't seem to be available in CentOS 7 by default so I switched to pkill.

Thanks in advance!

3
  • Your ExecStop did nothing. Systemd knows how to kill services (by killing everything in the relevant cgroup). We no longer have to resort to killing by PIDs contained in files. Just remove your ExecStop. Commented Jun 11, 2015 at 0:20
  • @jordanm Huh, you're absolutely right. I removed my ExecStop and the service was still stopping as it should, and I was no longer getting that message. Any idea on that other message, about the pid not readable after start? Should I be concerned with this? Commented Jun 11, 2015 at 13:09
  • @tycoonbob – If I had to take a shot, I'd say the first warning is caused by your app taking too long to create its pidfile, and as for the second, it was right in front of your nose: Executable path is not absolute, ignoring: pkill --pidfile /var/run/apps/application.pid. The given command, pkill, is not defined by an absolute path. You needed /usr/bin/pkill, or perhaps /bin/pkill. And, if your app catches SIGTERM and deletes the pidfile as part of its cleanup procedure, systemd probably would have moaned again when it no longer existed after ExecStop. Commented Dec 15, 2015 at 19:52

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.