ubuntu 设置开机启动与关闭开机启动(适用于部分linux系统)
生活随笔
收集整理的這篇文章主要介紹了
ubuntu 设置开机启动与关闭开机启动(适用于部分linux系统)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ubuntu 設置開機啟動與關閉開機啟動
首先,以apache開機啟動的關閉為例,
參見:http://blog.csdn.net/lyhdream/article/details/8897618
然后以tomact的開機啟動的添加為例:
執行命令sudo gedit /etc/init.d/tomcat6然后把以下英文部分復制過去。(注意第一句#!/bin/sh如果不寫,就不是一個shell文件。然后將對應的jdk和tomcat換成你自己的目錄就行了。?
#!/bin/sh? # # description: Auto-starts tomcat # processname: tomcat
export JAVA_HOME=/opt/jre1.6.0_33
case $1 in start) sh /opt/tomcat6/bin/startup.sh ;; stop)? sh /opt/tomcat6/bin/shutdown.sh ;; restart) sh /opt/tomcat6/bin/shutdown.sh sh /opt/tomcat6/bin/startup.sh ;; esac? exit 0
上面的步驟做好之后,執行sudo chmod 755/etc/init.d/tomcat6,讓這個文件是可執行的。 然后要做一個鏈接,即讓剛剛那個shell文件能開機自啟動。 sudo ln -s /etc/init.d/tomcat6 /etc/rc1.d/K99tomcat6 sudo ln -s /etc/init.d/tomcat6 /etc/rc2.d/S99tomcat6 在終端中執行sudo /etc/init.d/tomcat7start/stop/restart(三個選一個就能實現啟動,停止,重啟功能了) 安裝一個UBUNTU的服務管理 sudo apt-get install sysv-rc-conf
使用sysv-rc-conf sudo sysv-rc-conf
如下圖:
參考地址:http://blog.sina.com.cn/s/blog_644e226401013p3t.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀
總結
以上是生活随笔為你收集整理的ubuntu 设置开机启动与关闭开机启动(适用于部分linux系统)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ubunut 下关闭apache服务自动
- 下一篇: linux下用户配置文件与系统配置文件