A service is a program that starts automatically at boot time. Sometimes the services are also called as daemons.
A daemon is a process starts automatically at the boot time without user interface or human interaction daemons are auto start.
Ex: sync, init etc.,
To see all running services the command is #ps –ef | more
In the above output UID represents the user ID of the user who is running the service.
PID – process ID
PPID—parent process ID
STime – starting time of the process
CMD --- the command to initiate the process
TTY---- terminal type
There are two types of services they are
1. Standalone services or non- xinted services
2. Transient sercices or Xinted services
The service that starts at boot time and runs continuously till the server will down called standalone services.
To control the stand alone services the commands are # service and # chkconfig and the example for standalone services are.
Ex: NFS, named, Network, vsftpd, sshd etc.,
The command to check the status of the service is # service <service name> status
For suppose I am checking the ftp service status as follows.
From the above output the ftp service is running and the process id of the service is 2293.
The command to stop, start, restart and reload the service is
For suppose I am stopping the ftp service as follows
The reload and restart the service will be done at during the changes in the configuration files.
For example I am reloading the ftp service as follows.
By observing the above output the process id is changed from now to earlier which means that the process id is assigned dynamically by the system.
Stop and start the service with service command is temporary only for that session. To stop or start the service permanently we use the chkconfig command.
Use # chkconfig command to start or stop the service permanently.
#chkconfig –level 2345 nfs off ………… The service will off in runlevel 2,3,4,5
By using the command #chkconfig we can see the status of all service availability.
In the above output the numbers 0,1,2,3,4,5,6 are the run levels.
Suppose I am checking the service availability of ftp as follows
#service command: To start and stop the service with service command is immediate only for that session.
#chkconfig command: To start and stop the service with chkconfig command is permanent but in next reboot.
These services can be stop or start whenever you required which is not auto start. All the transient services are under control of xinted.
Ex: telnet, pop3, pop4, imap3, imap4
Note : Service command cannot be used for xinted services only chkconfig command.
To run the transient or xinetd services we have to install the package called xinetd. The service xinetd must run continually for the purpose of running the xinetd services.
To know the xinetd services as follows. These services are resided under /etc/xinetd.d. Before going to check these services install the xinetd package.
The above are the xinetd services.
Suppose I am going to check the telnet service .
Suppose I am starting the rsync service as follows.