Systemd: Serviços no Dia a Dia

Linux

Systemd: Serviços no Dia a Dia

Controle de serviço

ComandoAção
sudo systemctl start nginxInicia serviço
sudo systemctl stop nginxPara serviço
sudo systemctl restart nginxReinicia serviço
sudo systemctl reload nginxRecarrega configuração
systemctl status nginxExibe status detalhado

Boot e habilitação

ComandoAção
sudo systemctl enable nginxHabilita no boot
sudo systemctl disable nginxDesabilita no boot
systemctl is-enabled nginxVerifica habilitação

Logs

ComandoAção
journalctl -u nginx -n 100Últimas 100 linhas
journalctl -u nginx -fAcompanha logs em tempo real

Dica

Após alterar unit file, rode sudo systemctl daemon-reload antes de reiniciar o serviço.