I created the below systemd unit file (Centos 7) to run KMS server and logs the client requests to the kms-server.txt file. The service runs without any problem and responses to the client’s requests but the kms-server.txt file is empty. would you please help me to solve this problem?
[Unit] Description=PY-KMS After=network.target [Service] Type=simple User=root ExecStart=/bin/sh -c 'exec /usr/bin/python2.7 /usr/local/py-kms-master/server.py 192.168.1.100 1688 -v > /usr/local/py-kms-master/kms.log' [Install] WantedBy=multi-user.target
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:
[Service] #... ExecStart=/usr/local/py-kms-master/server.py 192.168.1.100 1688 -v StandardOutput=/usr/local/py-kms-master/kms.log 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.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.