Can nginx run a unix command based on url?
Nginx is able to run perl scripts when it's built with perl support. And it seems that you can program enything that can be done with a plain perl.
I think you should look at this direction.
While expirementing with perl you should keep in mind that perl interpreter blocks nginx process until finished so it's not recomended to run long-lasting jobs.
BTW: Perl support still marked as experimental.