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開機啟動
推薦文章: