Service:

A service is a program that starts automatically at boot time. Sometimes the services are also called as daemons.

 

Daemon:

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

[root@sys1 ~]# ps -ef | more
UID    PID PPID   C    STIME   TTY   TIME      CMD
root    1    0    0    10:31    ?    00:00:01  /sbin/init
root    2    0    0    10:31    ?    00:00:00  [kthreadd]
root    3    2    0    10:31    ?    00:00:00  [migration/0]
root    4    2    0    10:31    ?    00:00:00  [ksoftirqd/0]
root    5    2    0    10:31    ?    00:00:00  [migration/0]
root    6    2    0    10:31    ?    00:00:00  [watchdog/0]
root    7    2    0    10:31    ?    00:00:16  [events/0]
root    8    2    0    10:31    ?    00:00:00  [cgroup]
root    9    2    0    10:31    ?    00:00:00  [khelper]

 

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

 

What are the types of services?

There are two types of services they are

1. Standalone services or non- xinted services

2. Transient sercices or Xinted services

 

What are standalone 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.,

 

How to check the status of a particular service?

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.

[root@sys1 ~]# service vsftpd status
vsftpd (pid 2293) is running...

 

From the above output the ftp service is running and the process id of the service is 2293.

 

How to start, stop, restart and reload the service?

The command to stop, start, restart and reload the service is

# service <service name> stop/start/restart/reload

 

For suppose I am stopping the ftp service as follows

[root@sys1 ~]# service vsftpd stop
Shutting down vsftpd:                                               [ OK ]
[root@sys1 ~]# service vsftpd status
vsftpd is stopped

 

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.

[root@sys1 ~]# service vsftpd reload
Shutting down vsftpd:                                                [ OK ]
Starting vsftpd for vsftpd:                                          [ OK ]
[root@sys1 ~]# service vsftpd status
vsftpd (pid 7232) is running...

 

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.

Note:

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.

 

How to stop and start the service permanently?

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

 

How to check the status of all service availability?

By using the command #chkconfig we can see the status of all service availability.

[root@sys1 ~]# chkconfig --list
NetworkManager   0:off   1:off   2:on    3:on   4:on    5:on    6:off
abrt-ccpp        0:off   1:off   2:off   3:on   4:off   5:on    6:off
abrtd            0:off   1:off   2:off   3:on   4:off   5:on    6:off
acpid            0:off   1:off   2:on    3:on   4:on    5:on    6:off
atd              0:off   1:off   2:off   3:on   4:on    5:on    6:off
auditd           0:off   1:off   2:on    3:on   4:on    5:off   6:off
autofs           0:off   1:off   2:off   3:on   4:on    5:on    6:off
blk-availability 0:off   1:on    2:on    3:on   4:on    5:on    6:off
bluetooth        0:off   1:off   2:off   3:on   4:on    5:on    6:off

 

In the above output the numbers 0,1,2,3,4,5,6 are the run levels.

 

How to check the status of the particular service availability?

Suppose I am checking the service availability of ftp as follows

[root@sys1 ~]# chkconfig --list vsftpd
vsftpd    0:off    1:off    2:on    3:on    4:on    5:on    6:off

 

#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.

 

What are transient services or xinted services?

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.

[root@sys1 ~]# yum install xinetd –y
[root@sys1 ~]# cd /etc/xinetd.d
[root@sys1 xinetd.d]# ls
chargen-dgram   daytime-stream  echo-dgramtcpmux-server  time-stream
chargen-stream  discard-dgram   echo-stream              telnet
daytime-dgram   discard-stream  rsync                    time-dgram

 

The above are the xinetd services.

 

How to see the status of xinted service?

#chkconfig –list <service name>

 

Suppose I am going to check the telnet service .

[root@sys2 ~]# chkconfig --list telnet
telnet on

 

How to start or stop the service immediate and permanent?

#chkconfig -- <service name> on/off

 

Suppose I am starting the rsync service as follows.

[root@sys2 ~]# chkconfig --list rsync
rsync off

 

Topics Summary