CentOS 7 systemd service file (run python script) working, but logging errors?
2
votes
0
answers
12317
views
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: Starting Application Daemon...
Jun 10 18:36:44 centos7-test systemd: PID file /var/run/apps/application.pid not readable (yet?) after start.
Jun 10 18:36:44 centos7-test systemd: 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: Stopping Application Daemon...
Jun 10 18:49:43 centos7-test systemd: Stopped Application Daemon.
Jun 10 18:49:43 centos7-test systemd: [/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: [/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: [/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!
Asked by tycoonbob
(21 rep)
Jun 10, 2015, 10:53 PM
Last activity: Sep 16, 2017, 08:34 PM
Last activity: Sep 16, 2017, 08:34 PM