DEV Community

Bhaskar Sharma
Bhaskar Sharma

Posted on

πŸš€ Day 6 of My DevOps Journey: Linux Services & Systemd

Hello dev.to community! πŸ‘‹

Yesterday, I explored Networking Basics β€” the invisible backbone of DevOps. Today, I’m diving into Linux Services & Systemd β€” the tools that keep essential processes running reliably.

πŸ”Ή Why Services & Systemd matter for DevOps

Almost every DevOps tool (Jenkins, Docker, Kubernetes agents, Nginx, MySQL) runs as a service.

Systemd ensures services start on boot, restart on failure, and keep running.

As a DevOps engineer, you’ll often manage, monitor, and troubleshoot these services.

🧠 Core concepts I’m learning

βš™οΈ Systemd Basics

The init system that boots Linux and manages services.

Uses unit files (like nginx.service) to define how a service runs.

πŸ–₯️ Managing Services with systemctl

Start a service

sudo systemctl start nginx

Stop a service

sudo systemctl stop nginx

Restart a service

sudo systemctl restart nginx

Enable service on boot

sudo systemctl enable nginx

Check service status

systemctl status nginx

πŸ“œ Logs & Debugging

View logs for a specific service

journalctl -u nginx

Logs for the last 10 minutes

journalctl -u nginx --since "10 min ago"

⏰ Systemd Timers (cron alternative)

Timers let you schedule services (like cron jobs).

Example: backup.timer β†’ runs backup.service daily.

πŸ› οΈ Mini use cases for DevOps

Keep Jenkins and Docker running after reboots.

Debug why Nginx or MySQL failed to start.

Auto-restart a failed microservice.

Replace cron jobs with systemd timers for reliability.

⚑ Pro tip
If a service isn’t working:

Check if it’s enabled β†’ systemctl is-enabled service

Check logs β†’ journalctl -u service

Validate configs β†’ nginx -t, sshd -t

πŸ§ͺ Hands-on mini-lab (try this!)

Install Nginx:

sudo apt install nginx -y

Start & enable it:

sudo systemctl start nginx
sudo systemctl enable nginx

Verify:

systemctl status nginx
curl localhost

🎯 You should see the default Nginx welcome page! πŸš€

🎯 Key takeaway
Systemd is your control center for Linux services. Mastering it ensures apps stay reliable, resilient, and auto-recovering.

πŸ”œ Tomorrow (Day 7)
I’ll explore Docker Basics β€” stepping into the world of containers! 🐳

πŸ”– #Linux #Systemd #Services #Automation #DevOps #DevOpsJourney #SRE #CICD #OpenSource #DevOpsEngineer #CloudNative

Top comments (0)