4

Before systemd, my /etc/init.d/referee script would start/stop/restart a service without issue. Converting to systemd, which calls the same init.d script, the service starts without an error and then is somehow promptly called again with a stop.

When I run the service manually, the service starts and continues without issue. When started manually, the "systemctl status referee" shows the service as active (running)

I've have Type=forking. Is there another setting I need?

My system:

Distributor ID: CentOS
Description:    CentOS Linux release 7.1.1503 (Core) 
Release:    7.1.1503
Codename:   Core

A /etc/systemd/system referee.service file:

[Unit]
Description=keeper service
After=rc-local.service
After=syslog.target

[Service]
ExecStart=/usr/local/keeper/initscripts/referee start
ExecReload=/usr/local/keeper/initscripts/referee restart
ExecStop=/usr/local/keeper/initscripts/referee stop
Type=forking
# restart automagically after a reboot
Restart=always
RestartSec=10

[Install]
WantedBy=basic.target
1
  • For others experiencing a similar problem - I found that I had the wrong user. Running the script as root fixed the problem.
    – sscirrus
    Dec 2, 2017 at 1:13

1 Answer 1

4

It seems the Type=forking was causing the restarts. A better way was to remove the Type and use PIDFile= instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.