Fedora – service vs. systemctl scripts — which to use

fedorasystemd

In Fedora we have 'systemctl' and 'service' scripts. It seems that service internally calls systemctl. So what is the correct/right way on Fedora to start or stop services — via systemctl or service facility? May be there are nuances to keep in mind?

Best Answer

The way to stop/start services in Fedora (later versions) is using systemctl.

However, there may be a few services left in /etc/init.d/ which you could control with the service command. You can still control them with systemctl as systemd automatically maps them to unit files for you.

For example, on my CentOS 7 (Fedora 19 or thereabouts), there is a /etc/rc.d/init.d/network script which I could control with the service command. If I use systemctl instead, it still works:

# sudo systemctl status network
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: active (exited) since Tue 2014-11-11 08:21:51 GMT; 2 weeks 1 days ago

As you can see, it has been mapped to /etc/rc.d/init.d/network by systemd and the systemctl command controls it.

I could be so 'last year' and use service instead:

# service network status
Configured devices:
lo eth0
Currently active devices:
lo eth0 tun0

Both work, but note that they do give different results in their status commands.

Related Question