Systemd

From Wiki
Jump to navigation Jump to search

Manage Services

systemctl start nginx.service
systemctl stop nginx.service
systemctl restart nginx.service
systemctl reload nginx.service

Start on Boot

systemctl enable nginx.service
systemctl disable nginx.service

Services are called "units"

systemctl list-units        # show active services in memory
systemctl list-units --all  # show all services in memory
systemctl list-unit-files   # show all possible units

Reading Logs

journalctl      # show all logs
journalctl -b   # show all logs since last boot
journalctl -k   # show only kernel logs
journalctl -b -u nginx.service  # show logs for a service since boot