monitoring for errors via email?
Moderators: Dorian (MJT support), JRL
monitoring for errors via email?
I have a script on a trigger of "new file in folder" running on an unattended PC. Occassionaly I get an error but by the time I get to looking at the PC, there is a generic "time out waiting for user input" or something like that. Any way to have all errors sent immediately via email? Any other ideas on how to catch/monitor for the error I'm getting? The immediate notification option would be best.
Thanks
Thanks
A little more information please.
Are you using Macro Scheduler built in email capabilities or are you automating some other email client? Do you have any idea what the initial errors might be?
If you're using Macro Scheduler's RetrievePOP3> function you can monitor the variable POP3_RESULT looking for errors. Very easy then to detect an error then email that error to an email address using SMTPSendMail>
Are you using Macro Scheduler built in email capabilities or are you automating some other email client? Do you have any idea what the initial errors might be?
If you're using Macro Scheduler's RetrievePOP3> function you can monitor the variable POP3_RESULT looking for errors. Very easy then to detect an error then email that error to an email address using SMTPSendMail>
The script in question examines the contents of a shared network folder, moves files from that folder to a different shared network folder, inserts a row into a sql server table and uses the macro scheduler smtpsendmail command to email a copy of the file to a user. I suspect the error might be in moving files from one folder to another where the same file name might already exist. I've coded to append a suffix to the file name to avoid this and that code seems to be working. Just a hunch that duplicate file names might be the problem.
Regardless of the particular issue I might be having, I would like to know if there is a way to have ANY macro notifiy me via email that it has encountered a problem. Doing that via SMTPsendmail or any other method would be great.
Thanks
Regardless of the particular issue I might be having, I would like to know if there is a way to have ANY macro notifiy me via email that it has encountered a problem. Doing that via SMTPsendmail or any other method would be great.
Thanks
What you're doing is interesting in that I've been working on a similar project. I'm storing the files in folders named after the users email address rather than using a database. I'm picking up email for about 120 users who do not have any other email access, then providing access to their incoming messages as files. What I haven't yet written is a fully functional email client based on the file storage rather than actual email messages. I have a group of macros written for different email like functions (reply, forward, delete, etc.) just need to pull them together.
In any case. still not enough info to give a definitive answer but... here are some possibilities for you.
If the error comes from an executable file and the executable was started by a Macro Scheduler script and the script stays open afterward, it is possible the executable will provide an error code that can be trapped by the macro scheduler script. On trapping, an email could be sent.
If the error is logged to a file the file can be periodically tested to see if it has changed. On change, an email could be sent
If the error displays a window, the window can be detected and on opening an email could be sent.
In any case. still not enough info to give a definitive answer but... here are some possibilities for you.
If the error comes from an executable file and the executable was started by a Macro Scheduler script and the script stays open afterward, it is possible the executable will provide an error code that can be trapped by the macro scheduler script. On trapping, an email could be sent.
If the error is logged to a file the file can be periodically tested to see if it has changed. On change, an email could be sent
If the error displays a window, the window can be detected and on opening an email could be sent.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
If you want an email when any script error occurs, you could create your own error handler and use SMTPSendMail within it:
Code: Select all
Let>ONERROR=MyErrorHandler
..
..
SRT>MyErrorHandler
SMTPSendMail>[email protected],localhost,me,me,LAST_ERROR,LAST_ERROR,
END>MyErrorHandler
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Maybe this will explain it:
Code: Select all
Let>ONERROR=BIG_RED_BALLOONS
..
..
SRT>BIG_RED_BALLOONS
SMTPSendMail>[email protected],localhost,me,me,LAST_ERROR,LAST_ERROR,
END>BIG_RED_BALLOONS
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Or see the error handling section in the help file. Or here:
https://www.mjtnet.com/OnlineHelp/error_handling.htm
https://www.mjtnet.com/OnlineHelp/error_handling.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?