需求:開發環境(linux)重啟后,每次需手動啟動相關應用較為繁瑣,如設置為開機自動啟動則可減少此工作量。
google下,參考了以下博文較好解決了問題:
1. 簡單說明? Centos下設置程序開機自動啟動命令介紹 2. 詳細說明? Linux如何實現開機啟動程序詳解解決此問題有2種方法:
- 1 通過增加啟動程序為系統服務
如常見的mysqld, smb, ftp服務是通過此方法實現. ?可通過chkconfig命令將腳本增加為系統服務. 關于chkconfig命令使用可參考linux幫助文檔. 主要有:
chkconfig mysqld on/off/
- 2 啟動程序是普通sh命令
直接修改/etc/rc.d/rc.local, 增加相應命令即可, 此方法較簡單, 采用此方法. 如:

# !/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. # dev service setup (nginx,lms, tomcat...) --add by bryant 2015-2-27 /usr/local/nginx/sbin/ nginx /home/bo/war_project/tomcat/bin/ startup.sh /home/ovp/war_project/tomcat/bin/ startup.sh /home/client/war_project/tomcat/bin/ startup.sh /home/ovp/jar_project/drm-router/drm- router.sh start /home/ovp/jar_project/transCenter/ startup.sh /lms/bin//start-lms
??
補充:
- chkconfig說明
[root@streamserver rc.d]# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
顯示結果分為7組:0-6, 這個涉及到linux操作系統的啟動原理知識, 本文暫不做研究.
?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
