解決 開/etc/rc.local失效無效問題

有關linux下開機啓動/etc/rc.local失效問題的解決辦法,提供三種方式解決開機無法啓動rc.local文件的問題,需要的朋友參考下。

開機啓動/etc/rc.local失效問題的解決方法

第一種情況:
當ubuntur 隨機啓動文件 /etc/rc.local 失效時請按如下修改
1、echo /etc/rc.local >>/etc/profile &&  source /etc/profile
 注:當執行生效會看到效果(/etc/profile 文件在每個用戶登錄時會首先檢查並執行)
2、reboot
注:重新啓動檢測是否生效

第二種情況:
echo /etc/rc.local >>~/.bash_profile &&  source /etc/profile

第三種情況:
在 /etc/rc3.d 目錄下增加一個啓動腳本,然後重啓測試,內容如下:
 

cat /etc/rc3.d/StartDefautRoute.sh
#!/bin/bash
[email protected]   
route add default gateway 192.168.1.1 dev xenbr0

/etc/rc.local 中部分命令無法執行


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章