Ravindra BagaleCourses & study guides

Chapter 4: Linux Ops Refresh for DevOps

4.4 systemd — start, enable, status

On Amazon Linux and Ubuntu lab VMs, services are usually systemd units.

sudo systemctl status nginx
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl enable nginx # start at boot
sudo systemctl disable nginx

This site and the Cyber/AWS labs also use the familiar wrapper:

sudo service nginx status
sudo service nginx start
sudo service nginx reload

start vs enable. start = run now. enable = survive reboot. Students often start once, reboot the lab, and wonder why the site is dead — they forgot enable.

Goal Command idea
Is it running? systemctl status <name>
Run now systemctl start <name>
Run on boot systemctl enable <name>
Apply config without full stop (when supported) service <name> reload

Ravindra Bagale's Tip

Interview madhe start aani enable farak sanga. Reboot nantar site down = enable visarle. Lakshat theva!

Lab

On your existing EC2 (or local Linux VM):

  1. Pick a service you already installed in AWS labs (for example Nginx) or a simple process you run for badge API.
  2. Run systemctl status (or service … status) and screenshot/note Active state.
  3. curl -I http://localhost — note the status code.
  4. Follow logs with journalctl -f or tail -f while you curl again.
  5. Run ss -tlnp and find which process owns port 80 (or your app port).
  6. Run df -h and note if any filesystem is nearly full.