I have added the intervals option to my client.rb file in order to run chef-client every hour. My question is how do I know if this is working and running the client every hour and also, will this run in the background if I don't have the server open?
Which OS are you trying to do this on? And how is the Chef Client installed on that system?
The OS is ubuntu and Chef Client was installed via the packages on the chef.io page, not bootstrapped or anything.
Okay. Is the Chef Client installed as a systemd service? Is it running?
What happens when you type
sudo systemctl status chef-client?
Unit chef-client.service could not be found.
Okay, so it's not set up as a service (which is usually how automatic and periodic runs are done).
Let's check to see if there's a process running.
ps aux | grep chef-client | grep -v grep
Nothing comes up when I type that in so my guess is that there is not a process running?
Correct. The normal way to set up regular runs is with the
Install that cookbook on your Chef server (or locally, depending on how your setup was done) and run the
chef-client::default recipe. The default run interval is 30 minutes, so you'd want to make sure to set
node['chef-client']['interval'] to be 3600 (seconds).
Okay. Just one thing, I have tried installing and using this cookbook but it would return an error in the config.rb file at the very top at the helper functions line when I try to upload it to my chef server.
The other "normal" way is with a cron job. That keeps from running the chef-client binary 24x7, and is often easier to tune exactly when it will run, or allows skew in the run-times to keep the load on the chef server distributed.