Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM Dispatcher Invalidate Hanlder for IIS

Avatar

Level 3

I use IIS with Dispatcher Module where I have to configure custom invalidateHandler

 

Dispatcher.any:

    /invalidateHandler "D:\\Cache\\invalidateHandler.bat"

 

When page is published I see the following message in dispatcher logs

 

 Executing command: D:\Cache\invalidateHandler.bat "/content/test" "Activate" ""...

Command D:\Cache\invalidateHandler.bat exited with code: 1, status: 1
Invalidate script exited with status 1.

 

This is the body of the script

echo "Test"

 

Do you have any idea what is the problem here? Should I configure something more? I was unable to find documentation for dispatcher & IIS regarding this feature. 

 

5 Replies

Avatar

Community Advisor

Hi @bartek_887 ,

 

Here are the list of mentioned err codes for windows with possible reasons : https://www.tutorialspoint.com/batch_script/batch_script_return_code.htm

 

This says that code:1 is for unrecognised command however, echo is a valid command in windows terminal. I was unable to find other relevant documentation for your issue.

 

Thanks. 

Avatar

Community Advisor

@bartek_887 , sometimes it's an issue with access as well. Please make sure the apache/IIS user has read,write,execute access for the script file/location.

Did you try to execute the script manually and see if you were able to run the script? 

 

 

Avatar

Level 3

Hi, 

I checked that - I put in in the location where IIS creates cache + checked permissions. Sadly it does not work

Avatar

Community Advisor

Did you try to run the script manually and make sure it's not an issue with script? 

Exit code 1 means, it might be an error in the script itself. 

https://www.cyberciti.biz/faq/linux-bash-exit-status-set-exit-statusin-bash/ 

 

I had similar issues when i was trying to call shell script which is placed at dispatcher level and below debug steps helped me.

1. Make sure it's not an issue with Script. Execute the script manually and make sure the functionality works as expected.

2. Make sure the user has execute rights.

 https://bash.cyberciti.biz/guide/Setting_up_permissions_on_a_script 

3. Then try calling the script the way you want.

 

Hope this helps.

 

 

 

Avatar

Level 3

Hi @Siva_Sogalapalli 

 

I checked the script and it works correctly, no errors when I run it manually. I will check the permissions again.