How to control system services in Fedora Linux
Fedora Linux systems come with a command called “service” which can be used to control the system-wide services while the system is running. Typically each system service provides at least four operations: start, stop, restart, status. Using the “service” command, you can start, stop or restart a system service as shown below. The following example shows how to start and web server (httpd service).
[root@techpulp ~]# /sbin/service httpd start
Starting httpd: [ OK ]
[root@techpulp ~]#
Similarly you can stop a service (httpd in this case) as shown below.
[root@techpulp ~]# /sbin/service httpd stop
Stopping httpd: [ OK ]
[root@techpulp ~]#
To know if a system service is currently active or not, use “status” option as shown below.
[root@techpulp ~]# /sbin/service httpd status httpd is stopped [root@techpulp ~]# /sbin/service atd status atd (pid 2234) is running... [root@techpulp ~]#
However all the above operations are effective only for that system boot and they won’t have affect on the next boot. There is another command “chkconfig” which can be used to configure a system service whether it should be started at system boot or not.
The following command tells you whether a system service is configured run at boot for various run-levels.
[root@techpulp ~]# /sbin/chkconfig --list httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@techpulp ~]#
If you don’t know wht is a run level, just know that run level 1 is for single user mode boot, run level 3 is text mode with multi-user support and run level 5 is graphical mode.
[root@techpulp ~]# /sbin/chkconfig --list httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@techpulp ~]#
To enable a system service to start at system boot (in run levels 1, 3 and 5), use the following command.
[root@techpulp ~]# /sbin/chkconfig --level 135 httpd on [root@techpulp ~]# /sbin/chkconfig --list httpd httpd 0:off 1:on 2:off 3:on 4:off 5:on 6:off [root@techpulp ~]#
To disable a system service (in run levels 1, 3 and 5), use the following command.
[root@techpulp ~]# /sbin/chkconfig --level 135 httpd off [root@techpulp ~]# /sbin/chkconfig --list httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@techpulp ~]#

