Expand my Community achievements bar.

Get ready! An upgraded Experience League Community experience is coming in January.

automate clearing of cache at http://localhost:4502/system/console/scriptcache through Jenkins

Avatar

Level 1

I have been searching and not seen this addressed, so forgive me if this is a duplicate question.

 

Our production promotion process involves a number of steps, the last of which is the clearing of the AEM Script Cache. So far, we have been able to automate every step of the deployment via Jenkins, but have been unable to determine if there is a way to automate/script this particular step.

 

Is this possible, and if so, can someone advise as to how to accomplish this?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Community Advisor

Avatar

Level 1

That did not, unfortunately, provide any information about the script cache, but I was able to do some research and found the following solution. This curl command will submit the form on the script cache page and therefore clear it.

curl -u [admin login]:[admin password] -X POST --data-raw "script=all" http://localhost:4502/system/console/scriptcache

 

Avatar

Employee

Hello @RAMiesem1 

Yes, you can use the curl command (like the one you used - no request body needed):
curl -u "<admin-user>:<admin-password>" \
-X POST "http://localhost:4502/system/console/scriptcache"

This is equivalent to clicking Sling → Script Cache Status => Clear Cache in /system/console and is safe to use from Jenkins as a post-deploy step

Avatar

Level 4

@RAMiesem1 

 

AEM Script Cache can be cleared automatically via an HTTP POST to the Script Cache console. For example:

 
curl -u "<admin-user>:<admin-password>" -X POST "http://<host>:<port>/system/console/scriptcache"
  • This is equivalent to manually clicking Sling → Script Cache Status → Clear Cache.

  • It can be safely added as a post-deployment step in Jenkins to fully automate the promotion process.

  • No request body or additional parameters are required.

This approach removes the last manual step and integrates cleanly into your CI/CD pipeline.