Created
December 3, 2009 15:34
-
-
Save aqlong/248245 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!--- | |
| Written by Aaron Longnion, 2009-12-10 | |
| Usage: http://aqlong.posterous.com/coldfusion-probe-to-test-if-verity-is-running | |
| ---> | |
| <!--- verify if Verity is up, and if so does it have any collections? ---> | |
| <cfset verityErrorMsg = "Verity is down on this server!"> | |
| <cfif FindNoCase("Windows", Server.os.name)> | |
| <cfset testDir = "c:\data\verity\collections"> | |
| <cfelse> | |
| <cfset testDir = "/opt/jrun4/verity/collections"> | |
| </cfif> | |
| <cfif NOT DirectoryExists(testDir)> | |
| <cfdirectory action="create" directory="#testDir#" /> | |
| </cfif> | |
| <cftry> | |
| <cfcollection | |
| collection="VerityProbeTest" | |
| action="create" | |
| path="#testDir#" /> | |
| <cfcatch type="searchengine"> | |
| <cfif FindNoCase("collection already exists", CFCatch.message)> | |
| <!--- skip this error, it's ok for this probe ---> | |
| <cfelse> | |
| <cfoutput> | |
| #CFCatch.type#: #CFCatch.message#: #CFCatch.detail# | |
| </cfoutput> | |
| <cflog file="VerityProbeTest" type="error" text="(dir: #testDir#) #CFCatch.type#: #CFCatch.message#: #CFCatch.detail#"> | |
| <cfabort> | |
| </cfif> | |
| </cfcatch> | |
| <cfcatch type="Any"> | |
| <cfif FindNoCase("Unable to connect to the ColdFusion Search service", CFCatch.message)> | |
| <cfoutput> | |
| #verityErrorMsg# #CFCatch.type#: #CFCatch.message#: #CFCatch.detail# | |
| </cfoutput> | |
| <cflog file="VerityProbeTest" type="error" text="#verityErrorMsg# (dir: #testDir#) #CFCatch.type#: #CFCatch.message#: #CFCatch.detail#"> | |
| <cfabort> | |
| <cfelse> | |
| <cfoutput> | |
| #CFCatch.type#: #CFCatch.message#: #CFCatch.detail# | |
| </cfoutput> | |
| <cflog file="VerityProbeTest" type="error" text="(dir: #testDir#) #CFCatch.type#: #CFCatch.message#: #CFCatch.detail#"> | |
| <cfabort> | |
| </cfif> | |
| </cfcatch> | |
| </cftry> | |
| <cfcollection action="list" name="rsAllCollections" /> | |
| <cfif rsAllCollections.recordcount LT 2> | |
| <cfset verityWarningMsg = "All Verity collections are missing!"> | |
| <cfoutput> | |
| #verityWarningMsg# | |
| </cfoutput> | |
| <cflog file="VerityProbeTest" type="warning" text="#verityWarningMsg#"> | |
| <cfabort> | |
| </cfif> | |
| server running |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment