[systemd-devel] Best approach to run python service in virtualenv with systemd

Stanislav Kopp staskopp at gmail.com
Wed Apr 13 13:14:06 UTC 2016


Hi all,

I'm trying to run kallithea using virtualenv, it kinda works (I can
stop/start service) with this unit file

########################################
[Unit]
Description=Start Kallithea service
After=network.target

[Service]
Type=forking
User=kallithea
WorkingDirectory=/srv/kallithea
ExecStart=/srv/kallithea/venv/bin/python2
/srv/kallithea/venv/bin/paster serve --daemon
--pid-file=/srv/kallithea/kallithea.pid
--log-file=/srv/kallithea/kallithea.log my.ini
PIDFile=/srv/kallithea/kallithea.pid

[Install]
WantedBy=multi-user.target
#########################################

but I always see "Failed to read PID from file
/srv/kallithea/kallithea.pid: Invalid argument" in "systemctl status",
I know that "PIDFile" option isn't a best practice and should be
avoided, but withou it service doesn't running.
Is there any better methods to run it or at least remove this pid error message?


Thanks,
Stan


More information about the systemd-devel mailing list