原來的 service 命令與 systemctl 命令對比


 

 

service [服務] start       systemctl start [unit type] 啟動服務

 #啟動網絡服務  systemctl start network.service
service [服務] stop       systemctl stop [unit type] 停止服務

#停止網絡服務 systemctl stop network.service
service [服務] restart   systemctl restart [unit type] 重啟服務

#重啟網絡服務 systemctl restart network.service
此外還是二個systemctl參數沒有與service命令參數對應

status:參數來查看服務運行情況
reload:重新加載服務,加載更新后的配置文件(並不是所有服務都支持這個參數,比如network.service)
應用舉例:

#查看網絡服務狀態

systemctl status network.serivce

 


nginx php mysql 常用命令

systemctl status nginx

systemctl start nginx

service nginx restart #重啟 Nginx
service php-fpm restart # 重啟 php-fpm

 

systemctl start mysqld #啟動 MySQL
systemctl status mysqld #查看 MySQL 狀態
systemctl stop mysqld #關閉mysql

systemctl enable mysqld #mysql開機啟動

 



推薦文章:

 https://blog.csdn.net/w892824196/article/details/86663602

https://blog.csdn.net/u012834750/article/details/80501440


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM