Ask Your Question

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

asked 2013-07-08 05:57:38 -0500

Scott Roland gravatar image

updated 2013-07-09 11:14:59 -0500

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 16:34:32 -0500

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, 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 gravatar imageScott Roland ( 2013-07-09 12:22:23 -0500 )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 gravatar imagekdg1955 ( 2013-07-09 13:14:01 -0500 )edit

answered 2013-07-09 11:28:08 -0500

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

Question Tools


Asked: 2013-07-08 05:57:38 -0500

Seen: 4,606 times

Last updated: Jul 09 '13