The reason that it does not complete the startup sequence is because for forking Type, your startup process must end and end (see $ Man systemd.service - branching search).
Just use only the main process, do not demonize
One option is to do less. When using systemd, there is often no need to create daemons, and you can directly run the code without demonization.
This allows you to use a simpler type of service called simple to make your module file look like this.
[Unit] Description=Simplified simple zebra service After=syslog.target [Service] Type=simple User=node Group=node WorkingDirectory=/home/node/Node/ ExecStart=/home/node/Node/node.py StandardOutput=syslog StandardError=syslog [Install] WantedBy=multi-user.target
Note that -u in python shebang is not necessary, but in case you print something to stdout or stderr, -u ensures that output buffering is not in place and the printed lines are immediately intercepted by systemd and written to magazine. Without him, this would have appeared with some delay.
To do this, I added the StandardOutput=syslog and StandardError=syslog lines to the module file. If you do not need printed materials in your journal, do not worry about these lines (they do not have to be present).
systemd makes demonization obsolete
Although the title of your question clearly asks for demonization, I think the essence of the question is βhow to make my service work,β and although using the main process seems a lot easier (you donβt need to take care of the daemons at all), it can be considered the answer to your question.
I think that many people use demonization only because "everyone does it." When using systemd, demonization reasons are often obsolete. There may be several reasons to use demonization, but now it will be a rare case.
EDIT: fixed python -p to the correct python -u . thanks kmftzg
Jan Vlcinsky May 12 '15 at 11:29 a.m. 2015-05-12 11:29
source share