Managing System Services

Previous versions of Red Hat Enterprise Linux, which were distributed with SysV init or Upstart, used init scripts located in the /etc/rc.d/init.d/ directory. These init scripts were typically written in Bash, and allowed the system administrator to control the state of services and daemons in their system. In Red Hat Enterprise Linux 7, these init scripts have been replaced with service units.

Highlights of systemd:

It supports the Parallelization which increases the system boot time.

Systemd creates the sockets for each daemons and it just needs to connect to the sockets.

Automatic service dependency management which can prevent long time-outs.

A method of tacking related processes together by using Linux control groups.

Still RHEL 7 supports the shell scripts for few legacy services.(/etc/init.d).

Comparison of the service Utility with systemctl

service

systemctl

Description

service name start

systemctl start name.service

Starts a service.

service name stop

systemctl stop name.service

Stops a service.

service name restart

systemctl restart name.service

Restarts a service.

service name condrestart

systemctl try-restart name.service

Restarts a service only if it is running.

service name reload

systemctl reload name.service

Reloads configuration.

service name status

systemctl status name.service

systemctl is-active name.service

Checks if a service is running.

service --status-all

systemctl list-units --type service --all

Displays the status of all services.

Table 9.4. Comparison of the chkconfig Utility with systemctl

chkconfig

systemctl

Description

chkconfig name on

systemctl enable name.service

Enables a service.

chkconfig name off

systemctl disable name.service

Disables a service.

chkconfig --list name

systemctl status name.service

systemctl is-enabled name.service

Checks if a service is enabled.

chkconfig --list

systemctl list-unit-files --type service

Lists all services and checks if they are enabled.

chkconfig --list

systemctl list-dependencies --after

Lists services that are ordered to start before the specified unit.

chkconfig --list

systemctl list-dependencies --before

Lists services that are ordered to start after the specified unit.

The systemctl is a command to manage the different type of objects. These objects are called “units” .