service
プロセスとシステム
書き方
service <name> <start|stop|restart|status>SysV 時代から残る薄い外皮で、systemd の機械では単に systemctl へ渡すだけ、理解する語も少なめです。
よく使うオプション
| オプション | 意味 |
|---|---|
| start / stop / restart | The three verbs that work everywhere. |
| status | Ask the service how it is doing. |
| --status-all | List every init script and its state (Debian/Ubuntu). |
例
sudo service nginx restartRestart a service on a machine of any vintage.
service --status-allSee 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