2014年12月9日 星期二

linux 幾個關掉或開啟service的方法

http://carl830.pixnet.net/blog/post/58991014-linux-%E5%B9%BE%E5%80%8B%E9%97%9C%E6%8E%89%E6%88%96%E9%96%8B%E5%95%9Fservice%E7%9A%84%E6%96%B9%E6%B3%95

(如果想立即開啟或關掉就要用service 或是直接到/etc/init.d/底下去操作)
以下是用來設定在系統開啟時預設要執行的service
在RedHat系列底下可以用chkconfig
啟用httpd(如果已經加到chkconfig裡了 就可以不用輸入第一行)
chkconfig httpd --add
chkconfig http on

停用httpd(第二行是把httpd從chkconfig的管理中移除 我的建議是輸入第一行就好了)
chkconfig httpd off
chkconfig httpd --del

在Debian或Ubuntu底下的話 可以用update-rc.d
開啟apache2
update-rc.d apache2 defaults
關掉apache2
update-rc.d -f apache2 remove
至於前面提到的service 這裡提供一些簡單的範例(找不到這個指令的話可以用套件管理找找看)
service開啟httpd
service httpd start
用service關閉httpd
service httpd stop

沒有留言:

張貼留言