27 messages in ru.sysoev.nginxRe: Feature request: Run a script whe...
FromSent OnAttachments
Rt IbmerApr 28, 2008 8:44 am 
Cliff WellsApr 28, 2008 10:20 am 
mikeApr 28, 2008 11:53 am 
Rt IbmerApr 28, 2008 2:02 pm 
Cliff WellsApr 28, 2008 2:18 pm 
Manlio PerilloApr 28, 2008 2:37 pm 
Rt IbmerApr 28, 2008 6:10 pm 
Rt IbmerApr 28, 2008 6:19 pm 
Manlio PerilloApr 29, 2008 1:18 am 
Manlio PerilloApr 29, 2008 1:25 am 
Rt IbmerApr 29, 2008 8:11 am 
François BattailApr 29, 2008 10:46 am 
Rt IbmerApr 29, 2008 1:41 pm 
Manlio PerilloApr 29, 2008 1:57 pm 
François BattailApr 29, 2008 2:27 pm 
Aleksandar LazicApr 29, 2008 2:36 pm 
François BattailApr 29, 2008 11:20 pm 
Mansoor PeerbhoyApr 30, 2008 1:46 am 
Manlio PerilloApr 30, 2008 2:36 am 
François BattailApr 30, 2008 3:54 am 
Mansoor PeerbhoyApr 30, 2008 5:03 am 
Grzegorz NosekApr 30, 2008 5:18 am 
Cliff WellsApr 30, 2008 10:40 am 
Manlio PerilloApr 30, 2008 12:16 pm 
Manlio PerilloMay 1, 2008 2:42 am 
Grzegorz NosekMay 1, 2008 11:28 am 
Manlio PerilloMay 1, 2008 12:02 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Feature request: Run a script when upstream detected down/upActions...
From:Rt Ibmer (rtib@public.gmane.org)
Date:Apr 29, 2008 8:11:15 am
List:ru.sysoev.nginx

There are no problems at spawing an external process. Simply, Nginx does not directly support this and you will get a lot of NOTICE messages in the log when each process exits (even if it exits with a success status code).

That is fine. Such "upstream server down" events should be rare and the extra
notices in the logs will not impact things.

Personally I'm not interested in this feature, sorry. I have given a look in the Nginx source code and it seems that all you want is implementable, and it should require only a few hours of coding.

Thank you. Can you provide a hint as to what .c file(s) I would need to modify
and what types of system calls I should look at? Maybe all I need to do is find
the spot where nginx deems it should skip a downed server, and immediately after
that add this code: if (fork() == 0) execl("/bin/sh","/path/to/upstream_down.sh","ID of down upsteam goes here",
NULL);

Or should I be using the system() function?

Any other considerations I need to worry about?

Also if I make this change might it be adopted and incorporated into the
product? I would not want to have to keep applying my own patch every time I
compile a new version of nginx and am happy to contribute my work to this
excellent product and project. Thank you.