Linux / Unix: SysVinit Services Restart vs Reload vs Condrestart

Linux / Unix: SysVinit Services Restart vs Reload vs Condrestart

On a Linux or Unix system that uses the SysVinit init system, there are three main commands that you can use to control services: restart, reload, and condrestart.

  1. restart: The restart command stops the service and then starts it again. This is typically used when you want to apply new configuration changes or when the service is not responding.

  2. reload: The reload command reloads the configuration for the service without stopping and starting the service. This is typically used when the service supports dynamic reloading of its configuration.

  3. condrestart: The condrestart command is similar to restart, but it only restarts the service if it is already running. If the service is not running, condrestart does nothing. This is typically used when you want to apply new configuration changes without interrupting the service if it is already running.

To use these commands, you can use the service command followed by the name of the service and the command. For example, to restart the httpd service, you can use the following command:

ref‮re‬ to:lautturi.com
service httpd restart

To reload the configuration for the httpd service, you can use the following command:

service httpd reload

To only restart the httpd service if it is already running, you can use the following command:

service httpd condrestart

Keep in mind that you will need to have root privileges to use these commands.

On systems that use a different init system, such as systemd or upstart, the commands and options for controlling services may be different.

Created Time:2017-10-29 22:08:59  Author:lautturi