Service Management Documentation
Comprehensive guide to checking, monitoring, and managing systemd services on CentOS systems using systemctl and journalctl.
Common Commands​
Status Checking​
Check service status:
sudo systemctl status nginx
Check if service is running:
sudo systemctl is-active nginx
Check if service auto-starts on boot:
sudo systemctl is-enabled nginx
Control Operations​
Start service:
sudo systemctl start nginx
Stop service:
sudo systemctl stop nginx
Restart service:
sudo systemctl restart nginx
Reload configuration without restarting:
sudo systemctl reload nginx
Enable/Disable​
Enable service to auto-start on boot:
sudo systemctl enable nginx
Disable service auto-start:
sudo systemctl disable nginx
Prevent service from being started:
sudo systemctl mask nginx
Allow service to be started:
sudo systemctl unmask nginx
Logging​
Follow service logs in real-time:
sudo journalctl -u nginx -f
Show last 50 lines of logs:
sudo journalctl -u nginx -n 50
Show error messages only:
sudo journalctl -u nginx -p err
Related Sections​
- Linux Commands: One-Line Bash Commands
- Datadog: Datadog Setup
- Networking: Proxy Testing