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.
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