Linux add custom script to boot self-start method

  

Write a script auto_coreseek.sh:

The code is as follows:


  1. # !/bin/sh
  2. #chkconfig:2345 80 90
  3. #description:auto_coreseek
  4. /usr/local/coreseek/bin/searchd

    < Put it in /etc/init.d/auto_coreseek.sh

    Then chmod +x /etc/init.d/auto_coreseek.sh

    Then add it to the boot:

    chkconfig --add auto_coreseek.sh

    Finished.

    Then study this is all a little meaning.

    There are several levels of chkconfig:

    0: indicates shutdown

    1: indicates single-user mode

    2: indicates no network link multi-user command line Mode

    3: Indicates that there is a network link multi-user command line mode

    4: indicates that it is not available

    5: indicates a multi-user mode with a graphical interface

    6: means restart

    So chkconfig: 2345 means to start the service at 2345 level

    The following 80 90 are the startup priority and the shutdown priority respectively

    Talk about the priority of the program, the priority is also well understood, is the order in which the program is executed by the CPU, the smaller the value, the higher the finite level. So the startup priority and shutdown priority here mean the priority of the process that starts the script, and the priority of the process that closes the script.

Copyright © Windows knowledge All Rights Reserved