Trigger a git commit for static site generator

I build a small static site generator: just PUT markdown from a textarea
to a git versioned file and post-commit (and little bit
templating) to html for nginx.

The only thing I miss the commit triggerd by nginx after the PUT.

I tried it with shell ect^1 and even netcat :wink: but nothing worked
really nice.

Is there an easy way to commit via nginx?


Posted at Nginx Forum:,229477,229477#msg-229477

This *might *work (and can be dangerous IMO):

x="tail -f /usr/local/nginx/logs/access.log |grep PUT |sed 's/["]//g' |awk {'print $5'}"; while x=“PUT”; do git commit -m “Hello Igor”; done

Your logs would have to be formated like this: [08/Aug/2012:22:41:23 +0000] "PUT … [08/Aug/2012:22:41:23 +0000] "PUT …


Justin D.

The Science of Acceleration

Hi Justin,

thank you for this answer

… (and can be dangerous IMO):
x="`tail -f /usr/local/nginx/logs/access.log |grep PUT |sed ‘s/["]//g’

using tail on logs for this is very freaky;) but its a thinkable

To get only PUT requests I used an extra PUT log in the nginx config:

    if ($request_method = PUT) {
        access_log /var/log/nginx/accessPUT.log;

so I dont need to grep.

Unfortunately I dont “get over” the forced tail

x="tail -f /var/log/nginx/accessPUT.log";
c=“PUT” //to start an endless loop
while c=“PUT”; //
echo $x;
#~ git commit -m “Hello Igor”;

gave me noting, I expected the lines from the log.

At the moment I use, not-out-of-the-box;(, inotifywait but this works :wink:
But I will think more about tail

Posted at Nginx Forum:,229477,229546#msg-229546

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs