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?

  • 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...
    – user138906
    Sep 28, 2012 at 18:31
  • I am also having the same problem!!
    – Sabya
    Oct 3, 2012 at 14:16
  • Have you checked the obvious? Can nginx user access lua file? can nginx user write to /tmp/ ?
    – c2h5oh
    Oct 3, 2012 at 22:13
  • Lua can access git-magic.sh, git-magic.sh writes the right thing to /tmp/git-magic 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. Oct 22, 2012 at 11:54

1 Answer 1


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.

Not the answer you're looking for? Browse other questions tagged .