[ SRE_ARENA ]
SYSTEM ADMINISTRATION

System Administration & Infrastructure Operations

Visualization: 1. systemd — The OS Backbone
DOWNLOADING CONCEPT: 1. SYSTEMD — THE OS BACKBONE...
  • ↳In modern Linux, systemd is PID 1.
  • ↳It manages services, timers, network sockets, and mounts.
  • ↳If a service dies, systemd is what restarts it.
Unit Files
  • ↳Every service is defined by a unit file (e.g.
  • ↳/etc/systemd/system/myapp.service).
ini
[Unit]
Description=My App Server
After=network.target postgresql.service

[Service]
User=appuser
ExecStart=/opt/myapp/server --port 8080
Restart=on-failure
RestartSec=5
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
Commands

- systemctl start myapp (Start service now) - systemctl enable myapp (Set to start on boot) - systemctl daemon-reload (Mandatory after editing any .service file!) - systemctl list-units --failed (Check if anything is broken) - journalctl -u myapp -f (Tail the logs continuously) - journalctl -u myapp --since "1 hour ago" (Time-bounded log query)

▲ LIVE INCIDENTA junior admin ran usermod -G docker dev1 and now dev1 can't run sudo.
sre@arena:~/sysadmin
sre@arena:~$ id dev1