-1

Every time when I stop the httpd service, it automatically coming up. Below is the config file.

[root@server ~]# 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

When I stop the service "systemctl stop httpd", I see the following line in audit.log.

type=SERVICE_STOP msg=audit(1532445336.059:18928): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=httpd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

Immediately within few seconds I see this below entry in log file, stating service start command has been executed.

type=SERVICE_START msg=audit(1532445411.613:18931): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=httpd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

Looks like systemd is starting the service automatically, but I don't see "Restart=always" in config file.

I even tried the below, no help.

[Service]
Restart=on-failure
karthikeayan
  • 4,291
  • 7
  • 37
  • 75

1 Answers1

0

Review systemctl show httpd for the full configuration.

Something else may be starting your httpd server, for example socket activation or a systemd timer.

If you want nothing to start to your service, you can use systemctl mask httpd, after stopping the service but use with care-- it won't start at boot, either. unmask the service to start using it again.

Mark Stosberg
  • 12,961
  • 6
  • 44
  • 49