Наши партнеры

Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

9.4. Controlling services


UNIX systems use scripts to control “daemons” which provide “services” (for example your sound output) to run a UNIX system. UNIX systems consist of a variety of services (daemons).

A “daemon” is a system process which runs in the background (zero interaction) performing a particular task.

Daemons normally have a “d” on the end of their name and either listen for certain events or perform a system task, for example sshd listens for secure shell requests to the particular machine and handles them when they occur.

Daemons usually perform critical system tasks such as control swap-space, memory management and various other tasks.


service is a shell script available on Mandrake/Mandriva and Redhat systems which allows you to perform various tasks on services.

  • Use the -s option to print the status of all services available

  • Use the -f option followed by a service name to restart that particular service.

  • Use the -R option to restart all services (note that this will kill any current services running, including the X windows system).

For example to restart the daemon sshd you would type:

service -f sshd

You may also execute the shell script directly from /etc/init.d. Simply go to that directory then type ./script_name.

Executing the script should return the options it can take, by default they will be:

  • restart --- this will make the service stop and then start again.

  • start --- this option will start a service (assuming its not running).

  • stop --- this option will stop a service (assuming its running).

  • status --- this option will tell you about the service