Quantcast
Channel: SCN : All Content - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 4013

Scripts to notify through email only on failure

$
0
0

Hi All,

 

Currently my script sending email  only for Job success but now I need to send only failure only.

 

Can some one pleas share the script.

 

Below is my existing script ..

 

#------------------------------------------------------------#

#    Script to send email notification once job is completed

#------------------------------------------------------------#

$GV_NOTIFY_EMAIL = SQL('STAGING_DATA', 'SELECT EMAIL_LIST_SUCCESS FROM STG_DS_JOB_NOTIFICATIONS Where JOB_NAME = {$GV_JOBNAME}');

print( $GV_NOTIFY_EMAIL);

$GV_HOST_NAME = host_name( );

$GV_HOST_ENV = SQL('STAGING_DATA', 'SELECT DS_ENV FROM STG_DS_ENV_DETAILS Where upper(DS_HOST_NAME) = {$GV_HOST_NAME}');

Print('Sending successfull e-mail notification to the recepients');

smtp_to($GV_NOTIFY_EMAIL, '[$GV_HOST_ENV] - {$GV_JOBNAME} has completed successfully',

'This is an automated email notification for job completion :

JobName:{$GV_JOBNAME} has completed successfully ',0,0);

 

Please help me.

 

Thanks

Prakash


Viewing all articles
Browse latest Browse all 4013

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>