Skip to content

systemd basics: managing services on your VPS

By Onehost Team1 min read

systemd is the init system on modern Linux distributions. It starts services at boot and keeps them running. Two commands cover most of what you'll do: systemctl and journalctl.

Managing a service

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx     # reload config without downtime
sudo systemctl status nginx     # is it running?

Start on boot

sudo systemctl enable nginx     # start automatically at boot
sudo systemctl disable nginx

Reading logs

journalctl -u nginx             # logs for one service
journalctl -u nginx -f          # follow live
journalctl -u nginx --since "1 hour ago"

Running your own app as a service

Create a unit file in /etc/systemd/system/myapp.service with an ExecStart line and Restart=always, then systemctl enable --now myapp. systemd will keep it running and restart it if it crashes — far more reliable than nohup or a screen session.

Put it into practice

A KVM Linux VPS with full root access, billed in rupees.

Linux VPS plans