Sunday, August 28, 2016

Managing Services

You manage system daemons on a system using systemd in much the same manner that you do on a system that uses init. However, the command used is different. If you need to stop, start, restart, or view the status of a particular service on the system, you enter systemctl followed by the action you want performed, followed by the service name. Use the following syntax:

  •  To start a service, enter systemctl start service.service. For example, to start the ntp daemon, you would enter systemctl start ntp.service
  • To stop a service, enter systemctl stop service.service. For example, to stop the ntp daemon, you would enter systemctl stop ntp.service
  •  To restart a service, enter systemctl restart service.service. For example, to restart the ntp daemon, you would enter systemctl restart ntp.service
  •  To check the status of a service, enter systemctl status service.service. For example, to check the status of the ntp daemon, you would enter systemctl status ntp.service

On System Boot:

 You can also use the systemctl command to enable or disable a particular service on system boot. You can also check see whether or not it has been enabled. To do this, you use the following commands:

  •  To enable a service on system start, enter systemctl enable service.service. For example, to enable the ntp daemon on system boot, you would enter systemctl enable ntp.service.
  •  To disable a service on system start, enter systemctl disable service.service. For example, to disable the ntp daemon on system boot, you would enter systemctl disable ntp .service.
  •  To check and see whether a service is enabled or not on system startup, enter systemctl is-enabled service.service. For example, to check the status of the ntp daemon, you would enter systemctl is-enabled ntp.service.

No comments:

Post a Comment