Empty output file in systemd unit file

reza asked:


I used this unit file and here is the output but it won’t create any log files.


ExecStart=/usr/local/py-kms-master/server.py 1688 -v



[root@static ~]# systemctl status pykms -l
pykms.service - PY-KMS
   Loaded: loaded (/etc/systemd/system/pykms.service; enabled)
   Active: active (running) since Tue 2015-11-24 20:26:44 IRST; 3s ago
 Main PID: 2705 (server.py)
   CGroup: /system.slice/pykms.service
           └─2705 /usr/bin/python2.7 /usr/local/py-kms-master/server.py 1688 -v

Nov 24 20:26:44 static.clients.your-server.de systemd[1]: Starting PY-KMS...
Nov 24 20:26:44 static.clients.your-server.de systemd[1]: Started PY-KMS.

My answer:

First, it’s not necessary (and looks very bad) to use a shell script to start up a process in a systemd unit. Nor is it necessary to call a Python interpreter explicitly, if your Python script has the correct line at the top of it.

Start by cleaning up the unit file:

ExecStart=/usr/local/py-kms-master/server.py 1688 -v
StandardError= (whatever you want)

Second, look in the correct file. Your service is logging to kms.log but you have been looking at kms-server.txt. Either look at the other file, or change the destination.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.