在Ubuntu22.04中使用systemd 啟動 停止 重啟服務

systemctl [action] [service name]


apache2
systemctl start apache2
systemctl stop apache2
systemctl restart apache2
systemctl status apache2


ufw
systemctl start ufw
systemctl stop ufw
systemctl restart ufw
systemctl status ufw


mysql
systemctl start mysql
systemctl stop mysql
systemctl restart mysql
systemctl status mysql