8

So, I'm trying to execute a script on every request. I know how that sounds, this is for development environment.

I've added this to my nginx config access_by_lua_file "/opt/nginx/git-magic.lua";

git-magic.lua contains local status = os.execute('/opt/nginx/git-magic.sh')

And git-magic.sh contains: echo hello >> /tmp/git-magic

The issue is:

Whenever I hit any URL, I get the following in the nginx error log: 2012/09/27 15:35:48 [alert] 3241#0: waitpid() failed (10: No child processes)

Any ideas what I might be doing wrong?

6
  • wow... I'm having the EXACT same problem, and thought I was going nuts... I'm looking hard to see if I can find an answer... Commented Sep 28, 2012 at 18:31
  • I am also having the same problem!! Commented Oct 3, 2012 at 14:16
  • Have you checked the obvious? Can nginx user access lua file? can nginx user write to /tmp/ ? Commented Oct 3, 2012 at 22:13
  • Lua can access git-magic.sh, git-magic.sh writes the right thing to /tmp/git-magic Commented Oct 3, 2012 at 22:19
  • See if there's an apparmor.d file for nginx. I had a problem convincing dhcpd to run a file when an address is requested, because apparmor was blocking it. Commented Oct 22, 2012 at 11:54

1 Answer 1

0

The lua-resty-shell claims to solve this issue by supplying a non-blocking os.execute equivalent.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.