aris
August 8, 2012, 11:59pm
1
I build a small static site generator: just PUT markdown from a textarea
to a git versioned file and post-commit markdown.sh (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 but nothing worked
really nice.
Is there an easy way to commit via nginx?
thx
klml
Posted at Nginx Forum:
klml
August 9, 2012, 12:44am
2
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:
8.8.8.8 foo.bar.netdna-cdn.com [08/Aug/2012:22:41:23 +0000] "PUT …
4.2.2.2 bar.foo.netdna-cdn.com [08/Aug/2012:22:41:23 +0000] "PUT …
Regards,
Justin D. http://www.twitter.com/jdorfman
NetDNA http://www.netdna.com
The Science of Acceleration
klml
August 10, 2012, 12:42am
3
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’
|awk
…
using tail on logs for this is very freaky;) but its a thinkable
approach.
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”; //
do
echo $x;
#~ git commit -m “Hello Igor”;
done
gave me noting, I expected the lines from the log.
At the moment I use, not-out-of-the-box;(, inotifywait but this works
But I will think more about tail
git
Posted at Nginx Forum: