Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

systemctl command starting a service won't return on Fedora 22

Tags:

fedora

In directory /lib/systemd/system, I created a file XYZ.service. When running systemctl start XYZ, it doesn't return. I had to do Ctrl-C to come out the command. Wonder why. Interestingly, after I typed Ctrl-C. I can access the service XYZ.

Any idea what I did wrong? Thanks.

Here is the file XYZ.service

[Unit]
Description=XYZ
After=network.target

[Service]
Type=forking
ExecStart=/var/www/html/XYZ/ctrler

[Install]
WantedBy=multi-user.target
like image 638
packetie Avatar asked Aug 06 '15 02:08

packetie


1 Answers

Most likely, your command isn't forking, sometimes called daemonizing. You said Type=forking which means that the command is supposed to do a fork() and let the parent return when things are set up and the service is up and running. Your systemctl command is waiting for this to happen.

If the command runs without forking, you can tell systemd this by setting Type=simple.

See the manual page for systemd.service for further details on the Type configuration.

like image 142
Göran Uddeborg Avatar answered Oct 24 '22 13:10

Göran Uddeborg