Check whether cronjob has ran or not - cron

I have one python script running in crontab, I want to check if it is running successfully or not? if not then send mail or another kind of notification. How do I notify based on Cron logs?
Things I already Tried:
All the Exception in python file I have already handled
Need: Notify user if Cron job is not running successfully?

In order to notify weather cron job running or not, you can set email id in cpanel 'cron jobs' page. so you will receive email once file get executed.

There are monitoring services specifically for cronjobs, doing exactly what you're asking for. I'm partial to WDT.io and here're the detailed instructions: https://cookbook.wdt.io/cron.html.

Related

Email if a cron job succeeds on Cronitor

Is it possible to add a setting on Cronitor that sends an email once a cron job succeeds. Right now I only get email if a cron job fails.
This is what i have at the moment :
Alert preferences Failure tolerance Duration alerts
Alert notes
(X) Send alerts any time there is a problem
() Only send alerts if my job has consistently not run when expected...
I tried to email/contact support but now answer from Cronitor yet.
I'm one of the creators of Cronitor. I'm really sorry we somehow missed your support inquiry.
The answer is that, yes, this is possible but you cannot set this up without an API call. After the initial setup is complete (and the new alert rule is added) you can continue managing the monitor from the dashboard.
If you email support#cronitor.io again with specifics I can help you with adding this rule via the API.

Show Map/Reduce script error on a SuiteLet

I have created a Suitelet which runs a Map Reduce script when user Submits it.
I am able to show messages such as Completed, Failed or In Progress using task.checkStatus(taskId).
Is there anyway that I can also show the MR erros in UI, in case that M/R fails?
Probably I could use Custom Records to create the errors and then show them (too havy) or send the errors via email. But if there is a way I would prefer showing them directly to the user.
Any ideas, suggestions?
Thanks.
A couple of ways to do this:
Log the errors normally.
Periodically while the m/r is running run a search on the script logs filtering the results on the script and deployment.
Accumulate the errors and create a summarize phase in the m/r and email the results to the person who ran the m/r. Netsuiteā€™s example m/r has a hint about how to do that

airflow : wait to receive email and process data contained in attached file

I am looking for a wait to schedule tasks based on the reception of an email.
More precisely, I received an email with some attached data every week and I need to add these data into a database (and process some information). Is there a way to do it automatically?
Would airflow be a good option to do this? I found that airflow can send email but I did not find anything about reading mails.
I know it is possible to read email and download attached file in python. But what would be the best way to check if a specific email is received (defined by a sender) and process its data as soon as it is received ?
Airflow is a great option for this workflow.
Airflow has the concept of SensorOperators which are derived from the BaseSensorOperator. Using a SensorOperator will allow you to easily control the poke_interval and timeout of the task as well as how to handle the various situations depending on whether or not the email arrives as expected.
You could schedule some BashOperator or PythonOperator that periodically checks new mail and if they find one they start processing it. While I cannot give you any specific library, I am sure there must be a way to read and handle email in Python.

User event not firing on create event

I'm having a strange problem, where a user event, made to fire for sales orders on the Create event type, is not starting at all for some of them.
Trigger on: BEFORE SUBMIT FUNCTION
STATUS - Released
EVENT TYPE - Create
LOG LEVEL- Error
EXECUTE AS ROLE - Full Access
All access boxes are checked.
The only pattern I've found so far is that all failures are being created by a Script (Scheduled), which makes little sense to me...
Has anyone found a similar issue??
Do you want the scheduled script to trigger the user event script? Do you have the "All Roles" checkbox checked? I believe you need this to be checked for the UE script to be execute when the scheduled script creates a record.
You might want to check your scheduled script if it is error free. One possible reason why the user event script is not running is because the scheduled script has an error. Run your scheduled script first from the script debugger to see if there are errors.

can cron messages display images?

Very simple question - when I run a cron job, everything echoed gets caught and sent to me as a server notification email (not sure exactly what you'd call it). I was wondering if the format for these supports images?
Of course I could just send an email at the end of the cron with my image attached, but I'm curious as to the syntax and format of these server messages.
The output of the cron job is simply packaged up into a mail and sent to the relevant address.
So there's nothing stopping you from (for example) uuencoding an image and pushing that out to standard output, in the right format so that it shows up as an attachment at the destination.

Resources