5.2.2 Controlling a Service on CentOS or RHEL 6.x

Table of Contents Previous Next


5 Managing an Advanced Server Installation : 5.2 Controlling a Service on Linux : 5.2.2 Controlling a Service on CentOS or RHEL 6.x

On version 6.x of RHEL or CentOS Linux, you can control a service at the command line with the service command. The service command can be used to manage an Advanced Server cluster, as well as the services of component software installed with Advanced Server.
The Linux service controller mechanism allows you to start and stop the server gracefully. Using the service command to change the status of a service allows the service controller to keep track of the server status (the pg_ctl command does not alert the service controller to changes in the status of a server).
service service_name action
The Linux service command invokes a script (with the same name as the service) that resides in /etc/init.d. If your Linux distribution does not support the service command, you can call the script directly by entering:
/etc/init.d/service_name action
service_name specifies the name of the service.
action specifies the action taken by the service command. Specify:
start to start the service.
stop to stop the service.
condstop to stop the service without displaying a notice if the server is already stopped.
restart to stop and then start the service.
condrestart to restart the service without displaying a notice if the server is already stopped.
try-restart to restart the service without displaying a notice if the server is already stopped.
status to discover the current status of the service.

5 Managing an Advanced Server Installation : 5.2 Controlling a Service on Linux : 5.2.2 Controlling a Service on CentOS or RHEL 6.x

Table of Contents Previous Next