Date: 2015.8.27
Troubled the question of the afternoon, and at last the evening was settled, and put him in the record here
There are several situations in CentOS where rc.local cannot start on its own:
Rc.local file does not have executable permissions: Add executable permissions (Note:/etc/rc.d/rc.local is a source file,/etc/rc.local/etc/rc3.d/s99lcoal, etc. are soft connection files)
The environment variable is missing because the system starts with the last execution of rc.local, but some system or user environment variables are not loaded: Workaround: (1) Add the Sleep 10 delay 10 seconds before executing the script, but my side is not successful.
(2) Add the Source/etc/profile command before executing the script to load the environment variable. This afternoon, the node program script was unsuccessful because of the node variable problem.
Another situation is error: I met the start RABBITMQ times: Erlexec:home must be set Workaround: Add export Home=/usr/local/erlang in Execute script
#!bin/bash###################################################################### #Date:2015-08-13 # #Author: Qingbo.song # #E-mail:[email protected] # #Comment: Rabbitmq_start.sh # #Path:/home/apicloud/shell2e # #Vesion:v1.0 ######################################################################## Set up Erlang home directory, otherwise RABBITMQ will not bootSelf-starting Export home=/usr/local/erlang#rabbitmq start/usr/local/rabbitmq/sbin/rabbitmq-server
Rc.local
#!/bin/sh## This script is executed *after* all the other init scripts.# you can put your own initialization stuff in Here if you don ' t# want to do the full Sys V style init Stuff.touch/var/lock/subsys/localsource/etc/profilesh/home/she Ll/rabbitmq_start.sh#set Push_start.shsh/home/shell/push_start.shecho never >/sys/kernel/mm/transparent_ Hugepage/enabled
This article is from "Dolphin Watching" blog, please be sure to keep this source http://swht1278.blog.51cto.com/7138082/1689053
Troubleshooting a CentOS system custom script in rc.local cannot perform issues with a little memory