I diagnosed and controlled processes using ps and top for inspection, signals for lifecycle control, nice/renice for scheduling priority, and systemd for service management. Sending the right signal in the right order stopped a runaway process cleanly instead of with a blunt SIGKILL.

Objective & Context

Process control is core incident response on a host. This lab covers reading process state, the signal model (TERM before KILL), priority tuning, and systemd as the modern init/service manager, feeding the IR and sysadmin labs.

Environment & Prerequisites

  • Linux with procps-ng and systemd.
  • A test process to inspect and signal.
  • A managed service unit.

Step-by-Step Execution

1. Find the offending process

ps -eo pid,ppid,%cpu,%mem,comm --sort=-%cpu | head

2. Signal it gracefully, then forcefully

kill -TERM 4412 ; sleep 5 ; kill -KILL 4412 2>/dev/null

3. Manage a service with systemd

systemctl restart nginx && systemctl status nginx --no-pager
PID  PPID %CPU %MEM COMMAND
4412    1 98.7  2.1 stress-ng
nginx.service: active (running)

Validation & Testing

Start a CPU-bound test process, locate it, and stop it with the graceful-then-forceful sequence; restart a service and confirm it returns to active. Pass criteria: TERM is attempted before KILL and the service recovers cleanly under systemd.

Advanced: Troubleshooting
  • Process won't die: a process in uninterruptible sleep (D state) is waiting on I/O; address the I/O, not the signal.
  • Zombie processes: reap by fixing or restarting the parent, not by killing the zombie.
  • Service keeps dying: inspect journalctl -u service for the real failure.

Key Results

  • Identified the top CPU consumer instantly via sorted ps output.
  • Stopped runaway processes gracefully before forcing termination.
  • Managed service lifecycle reliably through systemd.
  • Diagnosed zombie and D-state cases correctly rather than blindly killing.