hero4hire
Linux

Restart a systemd unit

Reload the unit file and restart the service in one pass.

Restart after editing the unit file

Whenever a .service file under /etc/systemd/system/ changes, reload the daemon before restarting, or systemd keeps using the cached unit definition:

bash
sudo systemctl daemon-reload
sudo systemctl restart myapp.service

Check what happened

bash
systemctl status myapp.service
journalctl -u myapp.service -e --no-pager

-e jumps to the end of the log; --no-pager prints straight to the terminal instead of opening less.

See pruning a stale Docker image cache if the unit in question runs a container.

On this page