標籤:筆記
時間:2015.8.27
困擾了一下午的問題,晚上終於搞定,把他記錄在這裡
出現centos中rc.local不能自行啟動的問題,大概有這麼幾種情況:
rc.local檔案沒有可執行許可權:添加可執行許可權 (備忘:/etc/rc.d/rc.local為源檔案,/etc/rc.local /etc/rc3.d/S99lcoal等均為軟串連檔案)
缺少環境變數,因為系統啟動後最後執行rc.local,但是一些系統或者使用者的環境變數沒有載入:解決辦法:(1)在執行指令碼之前添加sleep 10延遲10秒執行,但是我這邊沒有實驗成功
(2)在執行指令碼之前添加source /etc/profile命令載入環境變數。今天下午執行node程式指令碼不成功就是因為node變數的問題
還有一種情況就是報錯:我遇到的是啟動rabbitmq時報:erlexec:home must be set 解決方案:在執行指令碼裡添加export HOME=/usr/local/erlang
#!bin/bash#######################################################################Date:2015-08-13 ##Author:qingbo.song ##E-mail:[email protected] ##Comment:rabbitmq_start.sh ##Path:/home/apicloud/Shell2E ##Vesion:v1.0 ########################################################################設定erlang家目錄,否則rabbitmq不能開機自啟動export HOME=/usr/local/erlang#rabbitmq start/usr/local/rabbitmq/sbin/rabbitmq-server
rc.local
#!/bin/sh## This script will be 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/shell/rabbitmq_start.sh#set push_start.shsh /home/shell/push_start.shecho never > /sys/kernel/mm/transparent_hugepage/enabled
本文出自 “守望海豚” 部落格,請務必保留此出處http://swht1278.blog.51cto.com/7138082/1689053
解決centos系統自訂在rc.local中的指令碼不能執行問題小記