views:

83

answers:

1

Is there any way to get Apache to run a command/program every time a web page is requested? I know I could scan the logs for new entries every minute or so, but can I get Apache to directly call the command? There might be an option like this in one of the configuration files, but if there is I don't know what it is. My server is running Ubuntu 9.04.

+2  A: 

You can use the CustomLog directive to pipe the access log to a script or program, which could be useful in your situation. All you would have to do is set up a while loop (or similar structure) on STDIN in the language of your choice and then execute your command from there.

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

Kendrick Erickson