解決centos系統自訂在rc.local中的指令碼不能執行問題小記

來源:互聯網
上載者:User

標籤:筆記

時間:2015.8.27

困擾了一下午的問題,晚上終於搞定,把他記錄在這裡


出現centos中rc.local不能自行啟動的問題,大概有這麼幾種情況:

  1. rc.local檔案沒有可執行許可權:添加可執行許可權  (備忘:/etc/rc.d/rc.local為源檔案,/etc/rc.local /etc/rc3.d/S99lcoal等均為軟串連檔案)

  2. 缺少環境變數,因為系統啟動後最後執行rc.local,但是一些系統或者使用者的環境變數沒有載入:解決辦法:(1)在執行指令碼之前添加sleep 10延遲10秒執行,但是我這邊沒有實驗成功

              (2)在執行指令碼之前添加source /etc/profile命令載入環境變數。今天下午執行node程式指令碼不成功就是因為node變數的問題 

  3. 還有一種情況就是報錯:我遇到的是啟動rabbitmq時報:erlexec:home must be set  解決方案:在執行指令碼裡添加export HOME=/usr/local/erlang 


  4. #!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
  5. rc.local


  6. #!/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中的指令碼不能執行問題小記

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.