2013年6月21日 星期五

開機後自動執行程式

環境:ubuntu12.04

1. 寫一支 shell script,放在 /etc/init.d 底下, ex: test.sh
2. sudo chmod 755 test.sh
    放在 /etc/init.d 底下,其實不會開機自啟動,那個目錄,只是用來收集腳本的而已
3. 真正開機自啟動的偵測目錄,是在:/etc/rcS.d
    cd /etc/rcS.d
    sudo ln -s ../init.d/test.sh S50test.sh

切到runlevel1時,S99xxx.sh 就沒有執行,真奇怪@@
換到 rc1.d 也沒用,再試試

懶惰的話,也可以寫在
~/.bashrc
~/.profile

沒有留言:

張貼留言