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

Version 1 Next »

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: 

  • a.cql contains cypher query
  • test.txt contains output of cypher query
  • 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