I'm just trying to daemonize this simple python script:
#!/usr/bin/python3
print('hello')
Here are my commands and the status:
root@gw-0317STLG0067 /lib/systemd/system # systemctl enable test.service
root@gw-0317STLG0067 /lib/systemd/system # systemctl daemon-reload
root@gw-0317STLG0067 /lib/systemd/system # systemctl start test.service
root@gw-0317STLG0067 /lib/systemd/system # systemctl status test.service
* test.service - My Script Service
Loaded: loaded (/usr/lib/systemd/system/test.service; enabled; vendor preset:
Active: inactive (dead) since Sun 2016-07-31 10:06:29 UTC; 4s ago
Process: 20620 ExecStart=/root/test.py (code=exited, status=0/SUCCESS)
Main PID: 20620 (code=exited, status=0/SUCCESS)
Jul 31 10:06:29 gw-0317STLG0067 systemd[1]: Started My Script Service.
Jul 31 10:06:29 gw-0317STLG0067 test.py[20620]: hello
And here my service script:
[Unit]
Description=My Script Service
After=multi-user.target
[Service]
Type=simple
ExecStart = /root/test.py
[Install]
WantedBy=multi-user.target
Why is it dead, and also what exactly should happen when you daemonize a print statement? Should it blow up the terminal?
Type=simple
? Looks likeType=oneshot
for me.