🖥️

Linux Service Management

Jun 19, 2025

Overview

This lecture explains how to check the status of, stop, start, and restart system services in Linux, using the Network Time Protocol (NTP) service as an example.

Service Management Basics

  • System administrators need to manage services (start, stop, restart, status) on various operating systems.
  • The service command is used in Linux to control services like NTP.

NTP (Network Time Protocol) Service

  • NTP keeps the system clock synchronized with standard time.
  • The NTP daemon (ntpd) runs in the background to maintain accurate system time.

Checking Service Status

  • Use service NTP status to view if the NTP service is running.
  • Any user can check the status of a service.

Adjusting System Time

  • NTP makes small clock adjustments (e.g., ±0.5 milliseconds per second) to avoid disrupting other services.
  • If the time difference exceeds 128 milliseconds, NTP does not auto-correct it.

Manual Date Modification and NTP Response

  • Manually changing the system date (e.g., to Jan 1, 2017) won't trigger NTP auto-adjustment if over the threshold.

Forcing NTP to Correct Time

  • Stopping and restarting the NTP service (sudo service NTP stop and sudo service NTP start) allows it to reset the clock to the current time.
  • Only administrators (using sudo) can stop or start services.

Restarting Services

  • The restart action (sudo service NTP restart) stops and starts the service at once.
  • Restarting is useful for applying changes or syncing time after large shifts.

Key Terms & Definitions

  • Service — A background process that performs tasks for the operating system or users.
  • Daemon — A program that runs as a background process.
  • NTP (Network Time Protocol) — A protocol for synchronizing computer clocks over a network.
  • Threshold — The limit (128 milliseconds for NTP) beyond which automatic adjustments are not made.

Action Items / Next Steps

  • Practice starting, stopping, restarting, and checking the status of services using the service command.
  • Review how NTP and other system services interact with system time.