
我使用的是 Ubuntu 11.10,我必須在啟動時執行 shell 命令。
java -jar selenium....
我嘗試過這個,但什麼都沒有:
sudo gedit /etc/init.d/nomescript.sh
sudo chmod a+x /etc/init.d/nomescript.sh
sudo update-rc.d nomescript.sh defaults
你知道我該怎麼做嗎?
謝謝你!馬可
答案1
Ubuntu 已經放棄了 SysV init 腳本方法來引導系統。
此連結解釋瞭如何建立 Upstart 腳本以及如何在啟動時運行它 -http://www.linuxplanet.com/linuxplanet/tutorials/7033/1/
答案2
您可以在 crontab 中新增一行:
@reboot command here
這幾乎可以保證它不會發生多次(如 /etc/rc.local 或 gnome 會話)。