I created a systemd file unit (Centos 7) and I wanted to save the Python output to a file but the service won't start with the below code.
[root@static ~]# cat /etc/systemd/system/pykms.service
[Unit]
Description=PY-KMS
After=network.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/python2.7 /usr/local/py-kms-master/server.py 192.168.1.100 1688 -v > /usr/local/py-kms-master/pykmsss.log
[Install]
WantedBy=multi-user.target
NOTE: if I delete the line after ">" above, then everything works fine but I want to save the logs to a file.
systemctl status pykms -l
[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:54:28 IRST; 2s ago
Main PID: 2788 (server.py)
CGroup: /system.slice/pykms.service
└─2788 /usr/bin/python2.7 /usr/local/py-kms-master/server.py 192.168.1.100 1688 -v
Nov 24 20:54:28 server.de systemd[1]: Starting PY-KMS...
Nov 24 20:54:28 -server.de systemd[1]: Started PY-KMS.