Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Most of the time there's nothing new in the git repo that is deployed to a local directory, but if there are any changes, the node.js application should be restarted to start working with the latest changes. It should not be touched if no new code was pulled.

How to achieve that with chef?

share|improve this question
Can't you use the git 'post-update' hook? – Christophe Drevet Dec 18 '12 at 12:06

1 Answer 1

up vote 2 down vote accepted

The git sync action actually triggers notifications if the revision has changed. So add an execute block that runs only on notification, and you're done!

git "/home/code" do
    action :sync
    notifies :run, "execute[restart-node-app]", :immediately

execute "restart-node-app" do
    command "..."
    action :nothing
share|improve this answer
Also check deploy resource which is more suited for deployment tasks – Poma Apr 25 at 4:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.