Linux service Management (ii)

Source: Internet
Author: User
Tags rsync

Second, RPM Package service management:

Standalone service starts fast, consumes more memory
Fewer services based on xinetd


The management method of independent service:
/etc/init.d/: Start Script location
/etc/sysconfig/: Initializing the Environment configuration file location
/etc/: Configuration file location
/ETC/XINETD.CONF:XINETD configuration file
/etc/xinetd.d/: XINETD Service-based startup script
/var/lib/: The data generated by the service is put here
/var/log/: Log

(Linux All files)
The start of the standalone service (the standard way is to find the absolute path to enter boot):
First,/etc/init.d/independent service name Start|stop|restart|status
All the services installed through the RPM package are in this file
/etc/rc.d/init.d/This directory is the same, the earliest time, all the services are placed in this directory, the use of older managers may be accustomed to this directory, the two are the same, in order to take care of the administrator habits, made a soft connection
Second, service independent name Start|stop|restart|status
But the service is not a Linux standard command, but the Redhat series is independently owned, and the other Linux does not have this command; the actual search is still an absolute path.
Self-booting of standalone service (running after next boot)
First, Chkconfig--list | grep Standalone Service name (view self-starting status)
Chkconfig--level 2345 stand-alone service name on (open)
Chkconfig--level 2345 Standalone service name off (off)
Ii. Modification of/etc/rc.d/rc.local file
There is also a software interface/etc//rc.local
When the system starts, the files are read after all the services are started;
Put the service start command here, save the exit, restart after the service can be run;
/etc/rc.d/init.d/stand-alone service name start
But this does not affect the first method, that is, after the addition, Chkconfig--list can not see the change, if the two methods are operating, the service will start after the boot two times, the second start will be error;
(The above two ways do not affect each other, it is recommended to use the second, that is, the way to modify the configuration file, just open this file to see, you can know)
Third, the NTSYSV command, and the first is the same, just a graphical interface;


Management of XINETD-based services:
Not account for memory, management efficiency is slow, and less;
The first step is to install the XIENTD service
View the port of the service: grep Rsyns (service name)/etc/services port is 873, default is not enabled

Start method:
Vi/etc/xinetd.d
Startup scripts for all services based on xient are in this directory
Modify the/etc/xinetd.d/service name file
Vi/etc/xinetd.d/rsync
Disable is not allowed to change the disable to No;
To restart the XINETD service after the modification/etc/init.d/xinetd restart
To check the port, 873 ports are already open.

Self-Starting method:
Similar to a standalone service, but without service commands, with Chkconfig and NTSYSC commands
Chkconfig rsync on
XINETD-based services are non-additive
Chkconfig rsync off not only boot, it will also be closed;

Start rsync, self-booting is turned on, off self-booting, and currently off
Based on the XINETD service, start-up and self-start are mixed into a group, starting and starting synchronization.


Third, source package service Management
Because of the different installation location, some commands to manage the RPM package service cannot directly manage the source package service, because the source package is not installed in the/ETC/RC.D/INIT.D directory, these service management commands will scan the directory;
Startup of the source package installation service:
Use an absolute path to invoke the startup script to start.
Different source packages have different startup scripts. You can view the installation instructions for the source package and see how to start the script.
/usr/local/apache2/bin/apachectl Start|stop|restart|status
(Starting Apache will have an error because the full hostname cannot be resolved to 127.0.0.1, does not affect the normal startup)
Self-booting of the source package service:
Vi/etc/rc.d/rc.local
Join the Start command
/usr/local/apache2/bin/apachectl start
You can do it.

Let the source package service be recognized by the Service Management command
Creating a soft connection
Ln-s/usr/local/apache2/bin/apchectl/etc/init.d/apachectl
Service commands can manage

Allow the Apache service of the source package to be chkconfig and NTSYSC command Management self-initiated
Add the following two sentences to the specified script first
Vi/etc/init.d/apachectl
Write Chkconfig: Run-level boot order shutdown sequence (boot sequence number and close sequence number cannot be viewed in the/ETC/RC.D directory with the existing sequential sequence number)
# Chkconfig 35 86 76
Write a document comment:
# Description:source Package Apachectl
Then use the command chkconfig--add apachectl

Linux service Management (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.