Set automatic startup of the startup service in linux

Source: Internet
Author: User
In linux, the boot service is automatically started. [root @ localhost ~] # Chkconfig -- list displays the services that can be automatically started upon startup [root @ localhost ~] # Chkconfig -- add *** add auto start upon startup *** Service [root @ localhost ~] # Chkconfig... set the boot service to automatically start in linux [root @ localhost ~] # Chkconfig -- list displays the services that can be automatically started upon startup [root @ localhost ~] # Chkconfig -- add *** add auto start upon startup *** Service [root @ localhost ~] # Chkconfig -- del *** delete boot auto start *** service www.2cto.com [root @ localhost ~] # Setup can be configured in the shell graphics terminal by selecting [root @ localhost ~] from the service # Ntsysv on the shell terminal graphical configuration boot start Service Command, the option is not the above multiple setup, rc. you can set the first option for both local and chkconfig. input # setup command to enter the system service menu, select the service you want to start, such as httpd, and restart the machine or/etc/rc. d. /init. d/httpd start www.2cto.com) place the startup command in/etc/rc. d/rc. in the local file, the service can be automatically started every time it is started. for example, for apache, after compiling apache, the apachectl file will be generated under the bin in the installation directory. this is a startup script, we only need to add this command to rc. local (suse does not have rc. local. SUSE can define its own script in this way. if you want to run your script before and after switching the running level, you can create:/etc/init separately. d/before. local/etc/init. d/after. local) echo/usr/local/apache/bin/apachectl>/etc/rc. d/rc. local, set the automatic startup mode of the service in rc. you can also add scripts similar to the following in local: # sshd/usr/local/sbin/sshd # proftpd/usr/local/sbin/proftpd # apache/home/apache/bin/apachectl start # mysql/home/mysql/bin/ safe_mysqld -- port = 3306 & # start oracle8i listener first su-oracle-c 'lsnrctl start' # start oracle8i su-oracle-c 'dbstart' 3) run the chkconfig command. use the chkconfig command to add a service to various running levels of the system. The procedure is as follows: 1. create a startup script. for software such as apache, mysql, and ssh, we only need to slightly modify it to support chkconfig. 2. modify the script. we need to add two lines before the script, to support the chkconfig command # chkconfig: 2345 08 92 # description: Automates a packet filtering firewall withipchains. # chkconfig, (92) descriptions: description of the service to be changed (ipchains packet filtering in the previous example ), you can execute the cp script/etc/rc after the modification you want. d/init. d/script name chmod 700/etc/rc. d/init. d/script name chkconfig -- add script name for example: to add it to the Linux startup process, only run [root @ Tester init. d]/sbin/chkconfig -- add apache-httpd [root @ Tester init. d]/sbin/chkconfig -- level 35 after apache-httpdon, our service will be automatically started and shut down every time we restart the server.
Related Article

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.