色婷五一,精品亚洲欧美一区二区三区日产 ,精选国产AV剧情,无码丰满少妇2在线观看

18600329666

咨詢技術(shù)專家

掃一掃
與技術(shù)專家在線溝通

Menu
centos7服務(wù)優(yōu)化之開機(jī)啟動(dòng)項(xiàng)配置和自定義系統(tǒng)服
         centos7X是centos6的升級(jí)版本,因?yàn)橄到y(tǒng)內(nèi)核和組成方面改動(dòng)較大,導(dǎo)致在命令,系統(tǒng)服務(wù),網(wǎng)絡(luò),安全等方面與7版本與6及以下版本有很大的區(qū)別,比如防火墻,[centos6] iptables,[centos7] firewalld,文件系統(tǒng)方面:[centos6] /bin, /sbin, /lib, and /lib64在/下,[centos7] /bin, /sbin, /lib, and /lib64移到/usr下,本文主要介紹centos7 開機(jī)啟動(dòng)及系統(tǒng)服務(wù)的配置操作
 
        Centos 系統(tǒng)服務(wù)腳本目錄 /usr/lib/systemd/ 有系統(tǒng)(system)和用戶(user)之分,如需要開機(jī)沒(méi)有登陸情況下就能運(yùn)行的程序,存在系統(tǒng)服務(wù)(system)里,即:/lib/systemd/system/  反之,用戶登錄后才能運(yùn)行的程序,存在用戶(user)里 服務(wù)以.service結(jié)尾。
1.建立服務(wù)文件(以nginx為例)
vim /lib/systemd/system/nginx.service
[Unit]  
escription=nginx
After=network.target  
 
   
[Service]  
Type=forking  
ExecStart=/www/lanmps/init.d/nginx start  
ExecReload=/www/lanmps/init.d/nginx restart  
ExecStop=/www/lanmps/init.d/nginx  stop  
PrivateTmp=true  
   
[Install]  
WantedBy=multi-user.target 
[Unit]:服務(wù)的說(shuō)明
 
Description:描述服務(wù)
After:描述服務(wù)類別
[Service]服務(wù)運(yùn)行參數(shù)的設(shè)置
Type=forking是后臺(tái)運(yùn)行的形式
ExecStart為服務(wù)的具體運(yùn)行命令
ExecReload為重啟命令
ExecStop為停止命令
PrivateTmp=True表示給服務(wù)分配獨(dú)立的臨時(shí)空間
注意:[Service]的啟動(dòng)、重啟、停止命令全部要求使用絕對(duì)路徑
[Install]服務(wù)安裝的相關(guān)設(shè)置,可設(shè)置為多用戶 Linux學(xué)習(xí),http:// linux.it.net.cn
2.保存目錄
以754的權(quán)限保存在目錄:/lib/systemd/system  
3.設(shè)置開機(jī)自啟動(dòng)
systemctl enable nginx.service 
4.其他命令
任務(wù) 舊指令  新指令
使某服務(wù)自動(dòng)啟動(dòng) chkconfig --level 3 httpd  on   systemctl enable httpd.service
使某服務(wù)不自動(dòng)啟動(dòng) chkconfig --level 3 httpd off systemctl disable httpd.service
檢查服務(wù)狀態(tài) service httpd status systemctl status httpd.service (服務(wù)詳細(xì)信息)  
systemctl is-active httpd.service (僅顯示是否 Active)
顯示所有已啟動(dòng)的服務(wù) chkconfig --list systemctl list-units --type=service
啟動(dòng)某服務(wù) service httpd start systemctl start httpd.service
停止某服務(wù) service httpd stop systemctl stop httpd.service
重啟某服務(wù) service httpd restart systemctl restart httpd.service
啟動(dòng)nginx服務(wù) IT網(wǎng),http://www.it.net.cn
systemctl start nginx.service  
設(shè)置開機(jī)自啟動(dòng)
systemctl enable nginx.service  
停止開機(jī)自啟動(dòng)
systemctl disable nginx.service IT網(wǎng),http://www.it.net.cn 
查看服務(wù)當(dāng)前狀態(tài)
systemctl status nginx.service  
重新啟動(dòng)服務(wù)
systemctl restart nginx.service  
查看所有已啟動(dòng)的服務(wù)
systemctl list-units --type=service 
 
       centos從低版本升級(jí)到centos7之后日常運(yùn)維命令的使用方面會(huì)有很大的區(qū)別,了解不同版本的差異及原理才能更好的使用