差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:commands:service [2016/01/04 18:34] ともやんlinux:commands:service [2025/04/19 15:36] (現在) – [シャットダウン、サスペンド、休止状態] ともやん
行 2: 行 2:
  
 ===== サービス起動 ===== ===== サービス起動 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ sudo systemctl start httpd.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> start httpd.service 
 +</pre></html></WRAP> 
 +</WRAP> 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> start <font color="#2A7BDE"><b>{</b></font>httpd,php-fpm<font color="#2A7BDE"><b>}</b></font> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ sudo service httpd start +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">service</font> httpd start 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== サービス停止 ===== ===== サービス停止 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ sudo systemctl stop httpd.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> stop httpd.service 
 +</pre></html></WRAP> 
 +</WRAP> 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> stop <font color="#2A7BDE"><b>{</b></font>httpd,php-fpm<font color="#2A7BDE"><b>}</b></font> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ sudo service httpd stop +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">service</font> httpd stop 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== サービス再起動 ===== ===== サービス再起動 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ sudo systemctl restart httpd.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> restart httpd.service 
 +</pre></html></WRAP> 
 +</WRAP> 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> restart <font color="#2A7BDE"><b>{</b></font>httpd,php-fpm<font color="#2A7BDE"><b>}</b></font> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ sudo service httpd restart +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">service</font> httpd restart 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== サービス設定反映 ===== ===== サービス設定反映 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ sudo systemctl reload httpd.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> reload httpd.service 
 +</pre></html></WRAP> 
 +</WRAP>
 サービスにHUPシグナルを送って設定を反映させる。\\ サービスにHUPシグナルを送って設定を反映させる。\\
 \\ \\
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ sudo service httpd reload +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">service</font> httpd reload 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== サービス自動起動設定 ===== ===== サービス自動起動設定 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ sudo systemctl enable httpd.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> enable httpd.service 
 +</pre></html></WRAP> 
 +</WRAP> 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> enable <font color="#A347BA">--now</font> httpd 
 +</pre></html></WRAP> 
 +</WRAP>
  
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ sudo chkconfig httpd on +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">chkconfig</font> httpd on 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== サービス自動起動無効設定 ===== ===== サービス自動起動無効設定 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ sudo systemctl disable httpd.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> disable httpd.service 
 +</pre></html></WRAP> 
 +</WRAP>
  
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ sudo chkconfig httpd off +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">chkconfig</font> httpd off 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== サービス状態表示 ===== 
 +Fedora 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269">systemctl</font> status acpid 
 +</pre></html></WRAP> 
 +</WRAP> 
 +<WRAP color_term> 
 +<WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269">systemctl</font> status <font color="#2A7BDE"><b>{</b></font>httpd,php-fpm<font color="#2A7BDE"><b>}</b></font> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== サービス一覧表示 ===== ===== サービス一覧表示 =====
-Fedora & CentOS 7 +Fedora 
-<code+<WRAP color_term
-$ systemctl -t service --all +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269">systemctl</font> <font color="#A347BA">-t</font> service <font color="#A347BA">--all</font> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 CentOS 6 CentOS 6
-<code+<WRAP color_term
-$ chkconfig --list +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269">chkconfig</font> <font color="#A347BA">--list</font> 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== systemd のランレベル設定方法 ===== ===== systemd のランレベル設定方法 =====
行 83: 行 144:
  
 ===== systemd のサービス定義ファイルの内容表示 ===== ===== systemd のサービス定義ファイルの内容表示 =====
-<code+<WRAP color_term
-$ cat /usr/lib/systemd/system/named-chroot.service +<WRAP color_command><html><pre> 
-</code>+<font color="#0087FF"><b>$</b></font> <font color="#26A269">cat</font> /usr/lib/systemd/system/named-chroot.service 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +===== シャットダウン、サスペンド、休止状態 ===== 
 +Fedora 
 +<WRAP mintbl> 
 +^  コマンド  ^  説明 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> <font color="#A347BA">--no-wall</font> reboot 
 +</pre></html></WRAP> | システムを再起動する 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> poweroff</pre></html></WRAP> | システムの電源を切る 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> <font color="#A347BA">--no-wall</font> poweroff 
 +</pre></html></WRAP> | システムの電源を切る (ログインユーザーに通知しない) | 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">shutdown</font> <font color="#A347BA">--poweroff</font> <a href="https://youtu.be/UhNDc-HwjFo?si=0l0YUuOn4zdYErlp">07:21</a> 
 +</pre></html></WRAP> | システムの電源を切る (指定時間に) 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> suspend 
 +</pre></html></WRAP> | システムをサスペンド(システム状態は RAM に保存)する 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font><font color="#999999"> </font><font color="#26A269">systemctl</font> hibernate 
 +</pre></html></WRAP> | システムをハイバネート(システム状態はディスクに保存)する 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> hybrid-sleep 
 +</pre></html></WRAP> | システムをハイブリッドスリープ(システム状態は RAM とディスクに保存、一定期間でサスペンドからハイバネートへ移行)する 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> suspend-then-hibernate 
 +</pre></html></WRAP> |   | 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> soft-reboot 
 +</pre></html></WRAP> |   | 
 +| <WRAP color_command><html><pre><font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">shutdown</font> <font color="#A347BA">--halt</font> +3 
 +</pre></html></WRAP> 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">shutdown</font> <font color="#A347BA">-c</font> 
 +</pre></html></WRAP> | | 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> halt 
 +</pre></html></WRAP> | | 
 +| <WRAP color_command><html><pre> 
 +<font color="#0087FF"><b>$</b></font> <font color="#26A269"><u style="text-decoration-style:solid">sudo</u></font> <font color="#26A269">systemctl</font> reboot 
 +</pre></html></WRAP> | | 
 +</WRAP> 
 + 
 +===== 参考文献 ===== 
 +[[https://community.nethserver.org/t/systemctl-and-vendor-preset-disabled/18355|Systemctl and "vendor preset: disabled" - Support - NethServer Community]]\\ 
 +[[https://www.freedesktop.org/software/systemd/man/systemd.preset.html|systemd.preset]]\\ 
 +[[rhdoc>ja/documentation/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-power#sect-Managing_Services_with_systemd-Power|10.4. システムのシャットダウン、サスペンド、および休止状態 | Red Hat Product Documentation]]\\ 
 +[[rhdoc>ja/documentation/red_hat_enterprise_linux/9/html/configuring_basic_system_settings/shutting-down-suspending-and-hibernating-the-system_managing-systemd#changing-the-power-button-behavior-in-gnome_changing-the-power-button-behavior|12.4. システムのシャットダウン、サスペンド、およびハイバネート | Red Hat Product Documentation]]\\ 
 +[[arc>Systemd#.E9.9B.BB.E6.BA.90.E7.AE.A1.E7.90.86|systemd - ArchWiki - systemd - ArchWiki]]\\ 
 +[[arc>%E9%9B%BB%E6%BA%90%E7%AE%A1%E7%90%86/%E3%82%B5%E3%82%B9%E3%83%9A%E3%83%B3%E3%83%89%E3%81%A8%E3%83%8F%E3%82%A4%E3%83%90%E3%83%8D%E3%83%BC%E3%83%88#.E9.AB.98.E3.83.AC.E3.83.99.E3.83.AB.E3.82.A4.E3.83.B3.E3.82.BF.E3.83.BC.E3.83.95.E3.82.A7.E3.82.A4.E3.82.B9_.28systemd.29|電源管理/サスペンドとハイバネート - ArchWiki]]\\ 
  • linux/commands/service.1451900051.txt.gz
  • 最終更新: 2019/05/18 02:23
  • (外部編集)