Getting Apache to run a command on every pageview

Is there a way to make Apache run a command / program every time a web page is requested? I know that every minute I could scan the logs for new entries, but can I get Apache to directly invoke the command? One of the configuration files may have this option, but if there is, I don't know what it is. My server is running Ubuntu 9.04.

0


a source to share


1 answer


You can use the CustomLog directive to connect the access log to a script or program that might be helpful in your situation. All you have to do is set up a while loop (or similar structure) to STDIN in your language of choice and then execute the command from there.



http://httpd.apache.org/docs/2.2/logs.html#piped

+2


a source







All Articles