---------------------------------------------------------------------------------------------------
|---1. Independent service
|----RPM Package default installed Service |---2. Based on XINETD services
Linux Service Categories: |
|----Source Package Installation Services
To query for installed services:
RPM Package Installation Services: Chkconfig--list (check the service self-boot status, you can see all RPM package installed services)
(7 runlevel, 0 for shutdown, 1 for single user, 2 for incomplete multi-user, 3 for character interface, 4 unassigned, 5 GUI, 6 reboot, if 2 3 4 5 are enabled, the service will start at 2 3 4 5 class with the next boot of the system)
Source Package Installation Services: Check the service installation location, usually under the/usr/local
The difference between the RPM installation service and the source package installation service is the different installation locations (resulting in different management methods):
The RPM package is installed in the default location;
The source package is installed in the specified location, generally/usr/local/
----------------------------------------------------------------------------------------------------
1. Management of RPM services - Independent service Management
The default location for RPM package installation:
/ETC/INIT.D (soft link) =/etc/rc.d/init.d #启动脚本位置
/etc/sysconfig/# Initializing Environment configuration file location
/etc/# configuration file location
/etc/xinetd.conf # xinetd config file
/etc/xinetd.d/# startup script based on XINETD service
/var/lib/# The data generated by the service is put here
/var/log/# Log
Installation:RPM-IVH package Name
Uninstall:RPM-E package name (find full package name: RPM-QA | grep package name)
start of a standalone service:
①/etc/init.d/Standalone Service Name Start|stop|status|restart # Absolute path startup. (Recommended method)
②service Standalone Service name Start|stop|restart|status # redheat exclusive command, automatically in the startup script to find, (equivalent to Centos7 in the Systemctl start service name. Services)
self-booting for standalone services:
①chkconfig [--level 2345] Standalone service name On|off # equals SYSTEMCTL Enable service name in CENTOS7
② Modify the/etc/rc.d/rc.local file as long as the standard command is written to the file and guaranteed to boot from. (Recommended method)
③ using the NTSYSV command to manage self-booting # Redheat proprietary commands
#!/bin/Bash
# A common self-starter script (/etc/rc.d/rc.local)
/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf &&/usr/local/php/sbin/php-fpm &/usr/local/redis/bin/redis-server/usr/local/redis/etc/redis.conf &/usr/local/xunsearch/bin/xs-ctl. sh Restart &
2. Management of RPM services - based on xinetd service Management
Installing xinetd:yum-y Install xinetd (after installation, Chkconfig--list can see XINETD-based services)
boot based on xinetd service: chkconfig telnet on/chkconfig telnet off (if the Telnet service is installed)
self-booting based on the XINETD service: Edit the XINETD service-based configuration file under/etc/xinetd.d/
Restart XINETD Services: Service xinetd restart
Cons: xinetd-based service start-up is associated with self-booting, as well as starting after startup, and shutting down self-booting also shuts down the xinetd-based service.
3. Source Package Service Management
startup of the source package installation service:
Use absolute path, invoke startup script to start, different source package startup script is different.
(You can view the method of startup script by looking at the installation instructions of the source package. )
self-booting of the source package service:
Script/etc/rc.d/rc.local join Start command
Let the source package service be recognized by the Service Management command:
Ln-s/usr/local/nginx/sbin/nginx/etc/init.d/nginx (not recommended, not conducive to the subsequent person to identify the installation of the service)
---------------------------------------------------------------------------------------------------
Link:http://www.cnblogs.com/farwish/p/4856631.html
@ Black eyed poet <www.farwish.com>
[Linux] Service Management: RPM package, source package