Startup items under Linux

Source: Internet
Author: User
Tags fpm

/etc/profile This is also the startup script. And the priority is very high oh.

The following are all online search

(1) Edit File/etc/rc.local

Input command: Vim/etc/rc.local will appear a text fragment similar to the following:

#!/bin/sh
#
# This script is executed *after* all and the other init scripts.
# can put your own initialization stuff in here if you don ' t
# want to does the full Sys V style init stuff.

Touch/var/lock/subsys/local
/etc/init.d/mysqld Start #mysql开机启动
/etc/init.d/nginx Start #nginx开机启动
/ETC/INIT.D/PHP-FPM Start #php-fpm boot
/etc/init.d/memcached Start #memcache开机启动

#在文件末尾 (before exit 0) plus the program you need to start or the command you want to run (the program you execute needs to write an absolute path, except for the system environment variable), such as:

/usr/local/thttpd/sbin/thttpd-c/usr/local/thttpd/etc/thttpd.conf

(2) Write a shell script yourself

Place the written script (. sh file) in the directory/etc/profile.d/, and the system will automatically execute all shell scripts in that directory after it is started.

(3) Set by Chkconfig command

Start file CP to/etc/init.d/or/etc/rc.d/init.d/(the former is the latter's soft connection)

Vim startup file, the file must be preceded by the following three lines of code, no side will prompt Chkconfig does not support

#!/bin/sh tells the system to use the shell, so the shell script is like this
#chkconfig: 35 20 80 represents the RunLevel, start priority, close priority, and the line code must
#description: HTTP server (self-play)//Two lines are commented out!!! , this line code must

Chkconfig--add The script file name operation has been added

Startup items under Linux

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.