Difference between Systemctl and service command
service
operates on the files in /etc/init.d and was used in conjunction with the old init system. systemctl
operates on the files in /lib/systemd. If there is a file for your service in /lib/systemd it will use that first and if not it will fall back to the file in /etc/init.d.Also If you are using OS like ubuntu-14.04 only service command will be available.
So if systemctl is available ,it will be better to use it
With borrowing from this answer:
service
is an "high-level" command used forstart
,restart,
stop
andstatus
services in different Unixes and Linuxes. Depending on the"lower-level" service manager, service redirects on differentbinaries.For example, on CentOS 7 it redirects to systemctl, while on CentOS 6it directly called the relative
/etc/init.d
script. On the otherhand, in older Ubuntu releases it redirects to upstart.
service
is adequate for basic service management, while directlycallingsystemctl
give greater control options.
Moreover, systemctl
runs services file from this path: /lib/systemd/