Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Execute shell script after dispatcher flushes the cache

Avatar

Level 6

I need to do some activities immediately after the dispatcher flushes the cache .  The activity can be done by a shell script. Is it possible to fire a script as soon as the dispatcher flushes the cache ?

1 Accepted Solution

Avatar

Correct answer by
Level 10
3 Replies

Avatar

Former Community Member

You can monitor the .stat file for change in timestamp using incrond . If the timestamp updates, your shell script can be run then.

You can check this here http://linux.die.net/man/8/incrond

Avatar

Correct answer by
Level 10

Avatar

Level 2
Level 2

Sham HC wrote...

Make use of invalidateHandler. Details & example at

http://docs.adobe.com/docs/en/dispatcher/disp-config.html#Using%20custom%20invalidation%20scripts

 

I have /invalidateHandler mapped to /var/www/cache/dispconfigs/disp.sh in publish-farm.any under /cache section

Now,

curl -H "CQ-Action: Delete" -H "CQ-Handle: /content" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" http://branda.com/invalidateHandler works fine and see the cache being deleted, but the one below does not work (trying to execute a custom script).

curl http://branda.com/invalidateHandler?parameter1&parameter2&parameter3 does not seem to work either. I get "The requested URL /invalidateHandler was not found on this server."  I guess the syntax is wrong. A sample of how to use curl with invalidateHandler would be helpful