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):
- Pick a service you already installed in AWS labs (for example Nginx) or a simple process you run for badge API.
- Run
systemctl status(orservice … status) and screenshot/note Active state. curl -I http://localhost— note the status code.- Follow logs with
journalctl -fortail -fwhile you curl again. - Run
ss -tlnpand find which process owns port 80 (or your app port). - Run
df -hand note if any filesystem is nearly full.