0

I run chef-client on some of my servers and want to be able to stop the service in case of testing or emergencies. However, when I stop the service using systemctl chef-client will resurrect itself within 5 minutes of stopping the service. Within the Unit file below I tried removing Restart = always, but the service will still restart and the Retsart = always will appear in the Unit file again. What configuration would I need to change to prevent chef from resurrecting itself?

[Unit]
Description = Chef Infra Client daemon
After = network.target auditd.service

[Service]
Type = simple
EnvironmentFile = /etc/sysconfig/chef-client
ExecStart = /opt/chef/bin/chef-client -c $CONFIG -i $INTERVAL -s $SPLAY $OPTIONS
ExecReload = /bin/kill -HUP $MAINPID
SuccessExitStatus = 3
Restart = always

[Install]
WantedBy = multi-user.target

EDIT: I don't see any cron jobs that are related to chef or any system timers set up.

aperna
  • 1
  • 1
  • It would appear the unit file is being (re)generated by something somewhere else. Check for a cron job or system timer, and/or find the source file that is used to regenerate the unit file. – C. M. Aug 01 '21 at 03:42
  • There doesn't appear to be any cron jobs related to chef, and there aren't any system timers set up on this machine. How could I go about finding the source file that is generating the unit file? – aperna Aug 01 '21 at 17:59
  • Unforunately, I am still learning about the differences with systemd style timers, so I am not a good source of information on those. I do know, however, that there are many of them in even a basic system setup, and many packages add their own. You may have to reference the chef-client package to find out what/where/how it modifies and works, which is beyond the scope of this site. (Unless you have a specific question about a single _part_ of such a package.) – C. M. Aug 03 '21 at 14:43

0 Answers0