CentOS 7.x , CentOS 8.xでは、サービスを起動する場合は、systemctlコマンドになっています。この状態でApacheのgracefulを使用すると「Unknown operation ‘graceful’.」のようなエラーになりました
$ sudo systemctl graceful httpd Unknown operation 'graceful'.
「graceful」のオプションは、設定ファイルを読み直すときにプロセスをKillしないで、子プロセスを接続を待ってから設定ファイルを読み直しますので、接続しているクライアントがいる場合は旧に接続断にならないので、アクセスが多いサーバーで設定ファイルを読み直す場合は、「graceful」を利用した方がいい場合は多いです。
systemctl配下では、「graceful」を使用する場合は、どのようにすればいいかというと「systemctl reload httpd」でいいかと思います。
/usr/lib/systemd/system/httpd.service のファイルで確認すると、reloadは「ExecReload=/usr/sbin/httpd $OPTIONS -k graceful」となっているので、reloadでいいかと思われます
$ cat /usr/lib/systemd/system/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-user.target
また、systemctlを使用しないで「apachectl 」のコマンドを使用して「apachectl graceful」とすれば、CentOS 6.xと同じように「graceful」を利用できます
$ sudo apachectl graceful
CentOS 6.xの「/etc/init.d/httpd」では、「$apachectl $@」となっているので、「apachectl graceful」といいかと思います
$ cat /etc/init.d/httpd
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;



コメント