Running all of your Endeca CAS crawls

I’ve recently been working with a customer who has a larger number of Endeca CAS crawls (300+) defined for their Endeca-driven enterprise search application.  Occasionally,  the need arises to rerun all of their crawls consecutively.

There are a number of ways to skin this cat; This certainly could be scripted using the java web service stubs that ship with CAS or scripted using java beanshell script in their AppConfig.xml file.

Recently, however, I wrote a quick and dirty DOS .bat file that leverages the cas-cmd.bat utitility to do this.

For those of you who find this need and don’t feel like sinking time into a java project, enjoy: 

@echo on
call cas-cmd listCrawls > crawls.lst
for /F "delims=" %%A in (crawls.lst) do CALL :RUNCRAWL %%A
GOTO END
:CHECKCOMPLETE
echo SLEEP 10
SLEEP 10
echo checking %1 status...
call cas-cmd getCrawlStatus -id %1 2>&1 | FIND "NOT_RUNNING" 
IF %ERRORLEVEL% == 1 GOTO CHECKCOMPLETE
GOTO END
:RUNCRAWL
IF %1 == "" GOTO END
echo running %1 ...
call cas-cmd startCrawl -id %1 2>&1 | FIND "CasCmdException" 
IF %ERRORLEVEL% == 1 GOTO CHECKCOMPLETE
:END

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s