Usually you use action :start when installing the service to make sure that it works after the chef starts, see Service Resource .
When changing a file that requires a service restart to make the changes active, you use the actions :reload or :restart (depending on what the init script suggests). Then it looks like this:
template "/etc/postgresql/pg.conf" do source "pg.conf.erb" notifies :restart, "service[postgres]" end
Learn more about Notifications .
Stephenking
source share