0

I'm looking for a way to configure nginx such that it will run a command line process with a given url.

The idea is to have a process to pull the latest version from git for a site if the repository is updated.

Getting bitbucket to call a url on an update is easy enough.
Not sure yet on how to action a command line process from nginx.

What would be the easiest way of doing this?

Found an answer here. nginx - How to run a shell script on every request?

The main difference between this question and the other question is I was not thinking 'shell' when I asked myself the question. I think in terms of processes. When I searched for process virtually nothing came up. I only found answers when I substituted 'shell' for 'process'. A subtle difference but a difference that will save someone some time in the future

Had a follow on issue with fcgiwrap on Ubuntu 12.04 which was resolved after reading CGI reply error on nginx server using fcgiwrap

Community
  • 1
  • 1
Keith John Hutchison
  • 4,955
  • 11
  • 46
  • 64
  • 1
    Possible duplicate of [nginx - How to run a shell script on every request?](http://stackoverflow.com/questions/22891148/nginx-how-to-run-a-shell-script-on-every-request) – tripleee Aug 07 '16 at 19:27

1 Answers1

1

You can use the answer you mentioned in your question but you can also add and use any script which can pull changes from git every X seconds.

Your code will be updated on every pull and there were no changes nothing will happen.

your script will look something like:

while [ 1 ] ; do git pull ... ; sleep X; done;

This line will run forever until you stop it. You can start it via script, use watchdog or crontab, whaever you fill more comfortable with.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167