service

プロセスとシステム

書き方

service <name> <start|stop|restart|status>

SysV 時代から残る薄い外皮で、systemd の機械では単に systemctl へ渡すだけ、理解する語も少なめです。

よく使うオプション

オプション意味
start / stop / restartThe three verbs that work everywhere.
statusAsk the service how it is doing.
--status-allList every init script and its state (Debian/Ubuntu).

sudo service nginx restart

Restart a service on a machine of any vintage.

service --status-all

See every service the old init system knows about.

何が動いていて何が資源を食っているかを見ます。止める前に何なのかを確かめるのが順番です。

読み方

  • 角括弧 [ ] は省いてよい部分です。
  • 三点 … は複数並べられるという意味です。
  • オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。

よくある質問

Q. service は何をしますか。

SysV 時代から残る薄い外皮で、systemd の機械では単に systemctl へ渡すだけ、理解する語も少なめです。

Q. どう打ちますか。

service <name> <start|stop|restart|status> — 角括弧は省いてよい部分です。

Q. よく使うオプションはいくつですか。

ここにまとめたのは3個です。全部は man service にあります。このコマンドはプロセスとシステムの仲間です。

関連するコマンド

man ページ: man service