I Have a Rscript file (Main_Script.R) which runs as a sheduled job in windows Task Scheduler every 30 Mins.Inside the Main_Script.R
- i have around 13 scripts that runs every 30 mins.
I wanted to send Email from R - whenever an iteration is failed or haulted.
I am using sendMailR package - and i have seen an post in SO how to send email with attachment from R in windows
- on how to send emqil from R Windows.
But i am not sure about - how to send an email automatically with the error message
- when the scheduled task iteration is failed or haulted.
My Main_Script.R
- has source
of all 13 codes.
source(paste(rootAddress,"Scripts/Part1.R",sep =''))
source(paste(rootAddress,"Scripts/Part2.R",sep =''))
:
:
:
:
source(paste(rootAddress,"Scripts/Part13.R",sep =''))
My Sheduled task looks like below with log file
"D:\xxx\R-3.0.2\bin\x64\Rscript.exe" "D:\xx\Batch_Processing\Batch_Processing_Run\Scripts\Main_Test.R" >> "D:\XXX\Batch_Processing\Batch_Processing_Run\error.txt" 2>&1
Update:
When the script encounters error - it should trigger email - with the erorr meassge and the script name or number -to denote which of the 13 scripts failed and send to a mail ID.