Skip to content
Latchkey

service Command Reference: Usage & CI Examples

service runs init scripts to start, stop, and query services.

service is a portable wrapper that runs SysV init scripts (and redirects to systemd where present). It is handy in containers and images that ship init scripts but do not boot systemd.

Common flags and usage

  • service <name> start|stop|restart: control a service
  • service <name> status: show current status
  • service --status-all: list known services and state
  • Runs /etc/init.d/<name> under the hood
  • On systemd hosts it forwards to systemctl

Example

shell
service postgresql start
service postgresql status

In CI

In a Debian/Ubuntu container without systemd, service postgresql start runs the init script directly and works where systemctl fails. It does not wait for readiness, so still follow it with a probe like pg_isready.

Key takeaways

  • service runs SysV init scripts and works without systemd.
  • It is the container-friendly way to start a bundled service.
  • It does not wait for readiness, so pair it with a probe.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →