Linux Service Management
First, Classification of Linux services
Independent Service
RPM Package default installation service
Linux Services based on the xinted service
Source Package Installation Services
Ii. Independent Services
1 . View the installed Services
(1), check the RPM Package Installation Services
Chkconfig--list View all services and all service opening status
Chkconfig--list [ service name ] View the open status of this service
first column: Service namesecond to seventh column: service in1-6these six operating levels are enabled, onmeans open,Offmeans close,1-6respectively: Shutdown single user mode, multi-user command line mode without network connection, multi-user command line mode with network connection, unavailable, multi-user mode with graphical interface, restart six runlevel.
1-6 These six run levels can be viewed in the init process's profile again to view the init configuration file commands:
Cat/etc/inittab
in the init configuration file, there are 1-6 descriptions of these six runlevel, in the last line
Medium:5 means boot into Level 5, enter the graphical interface.
(2), the source code package installs the service generally in:/uer/local/.
2. Independent service Start-up method
(1),/etc/init.d/Independent service name Start|stop|status|restart
(2), service independent name start|stop|status|restart--"Red Hat Proprietary Command"
3, starting from the independent service
(1), Chkconfig--level 2345 Independent service name on
Chkconfig--level 2345 Standalone service name off
For example, open and close the Apache service on the 2345 runlevel.
where2345 represents the run level.
(2), "recommended method" modify /etc/rc.d/rc.local configuration file
Vim/etc/rc.d.rc.local
after opening the file, add a line at the end of the file:
/etc/rc.d/init.d/[ service name ] Start
For example, modify this file to make Apache service boot from boot
after the modification, the/etc/rc.d/rc.local file is opened each time a reboot occurs .
(3),ntsysv command--"Red Hat exclusive Command"
Enter the ntsysv command under root user to display a service GUI, select OK and press Tab button to switch to "OK"
and "cancel" on.
In front of the service you want to open, hit the "*" sign, and the service does not start with spaces.
Note :3 ways can only be used in one, can not be used at the same time, or will error, because this will be a few at the same time occupy a port.
Third, based on the xinted service
need to install xinted service before use , if do not install xinted service, use chkconfig--list View service, Won't
The xinted service appears.
To install the xinted service:
Yum-yinstall xinted
and then use the Chkconfig--list to view the service and finally have the xinted service
Four, the source package service
1. Source Package Service starts
(1), start with absolute path:
For example, the source package installed Apache start and stop:
/usr/local/apache2/bin/apacectl Start|stop
(2), modify the /etc/rc.d/rc.local file
Vim/etc/rc.d/rc.local
add a row at the end /usr/local/apache2/bin/apacectl start
V. Important File Locations
/etc/init.d/ Startup script location
/etc/sysconfig/ Initializing Environment configuration location
/etc/ configuration file Location
/etc/xinetd.conf xinetd configuration file
/var/lib Server-generated data
/var/log Log
Linux Service Management