Ask Your Question

How do I tell systemctl to forget an init.d script and use a systemd one?

asked 2013-07-08 10:57:38 +0000

Scott Roland gravatar image

updated 2013-07-09 16:14:59 +0000

I am running Fedora 19 and tried to install an old custom /etc/rc.d/init.d script. When it didn't work I decided to try to convert it to a new systemd script.

I deleted my script /etc/rc.d/init.d script/license-autossh, created a new file /usr/lib/systemd/system/license-autossh.service and made a symbolic link in /etc/systemd/system/ pointing to the latter file.

My problem now is that when I run sudo systemctl status license-autossh.service it is clearly running a copy of my old init.d script, even though I deleted it. I tried running sudo systemctl --system daemon-reload but that didn't fix anything.

Strangely, running sudo systemctl start license-autossh.service does actually do what I specified in the new systemctl script.

How do I tell systemctl to forget the old init.d script and use the new systemd service file?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-07-08 21:34:32 +0000

kdg1955 gravatar image

One of the big difference between systemd and init.d is the syntax of the scripts. Init.d is the outdated way and all the controls are included inside the script. Systemd service files include all the parameters which systemd may need to manage a service.

  • If you have an init.d scripts you need first disable it with sudo chkconfig --del <service> (see also 'man chkconfig'). First check all init.d services with sudo chkconfig --list.

  • To create a new systemd service file: see man systemd, man systemd.unit & man systemd.target, and look add some installed example (i.e. /usr/lib/systemd/system/httpd.service).

It is not recommended to remove init.d script that are installed with a rpm package. An update of that package will put you in trouble.

edit flag offensive delete link more


I had never installed me script with chkconfig on this machine, so it doesn't show up in the list. Useful tip for others, or me in the future.

Scott Roland ( 2013-07-09 17:22:23 +0000 )edit

I had indeed poorly understood that you had moved your old init.d script to the systemd directory. Glad to hear that it is resolved. In my opinion: if chkconfig doesn't show up the service, it had been removed with systemctl.

kdg1955 ( 2013-07-09 18:14:01 +0000 )edit

answered 2013-07-09 16:28:08 +0000

Scott Roland gravatar image

It turns out that systemctl status was working as intended. The manpage says that status will show the "most recent log data from the journal".

So unlike the old init.d scripts, status doesn't actually run anything when used with systemctl. The status command was showing me old output from when it was an init.d script, which gave me the false impression that it was still running an old version of the script. The timestamps should have given it away, they were easier to notice when I came back to the problem a day later.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.


Asked: 2013-07-08 10:57:38 +0000

Seen: 2,260 times

Last updated: Jul 09 '13