Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Here is a .bat script to trigger mail as result of Neo4j Cypher query execution? Like to know agent running and data duplication status as examples.


 Prerequisite
Copy and paste the sample script and modify based on your requirement

@echo off
cd C:\Insights\InSights_V1.0\Server1\neo4j-community-3.0.6\bin
call neo4j-shell.bat -file C:\Insights\a.cql > C:\Insights\sendEmail-v156\test.txt
findstr /C:"| 0" C:\Insights\sendEmail-v156\test.txt
ECHO %ERRORLEVEL%
if ERRORLEVEL 1 (
echo "String NOT found..."
) else (
echo "String found"
cd C:\Insights\sendEmail-v156
sendEmail.exe -f fromaddress -t toaddress -s smtp.gmail.com:587 -o tls=auto -xu username -xp password -u "Subject" -m "This is test mail" -a test.txt
)


Note: 

  • Create your own .cql file with cypher query (As a.cql used in script)
  • Create your own .txt to write output of cypher query (As test.txt used in script)
  • findstr command checks literally existence of "| 0" in test.txt file
  • sendEmail.exe sends a mail
  • Used gmail server and port 587 for testing purpose


Top Section

  • No labels