Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Send an email if "No such file or directory" in the shell script program log in EBS concur


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Send an email if "No such file or directory" in the shell script program log in EBS concur

Hi All,

I have the below code(.sh) and need to send an email.
Code:
#!/bin/bash
cp /u02/xxc_incoming/TEST*.dat /u02/xxc_archive_incoming/AMER7764_ARPP_2/
cat /u02/xxc_incoming/TEST*.dat > /u02/xxc_incoming/XXC_TEST.dat
rm /u02/xxc_incoming/TEST*.dat
cd $XXC_TOP/bin
sqlldr userid=apps/<pwd>  control=/u02/xxc/1.0/bin/XXC_INSERT.ctl rows=1
cat /u02/xxc_incoming/XXC_TEST.dat >> /u02/xxc_archive_incoming/AMER7764_ARPP_2/XXC_TEST.txt

Program log is showing below messages , if this one or some thing error occurs so then send an email.
cp: cannot stat ‘/u02/xxc_incoming/TEST*.dat’: No such file or directory
cat: /u02/xxc_incoming/TEST*.dat: No such file or directory
rm: cannot remove ‘/u02/xxc_incoming/TEST*.dat’: No such file or directory

could you please help me?

Thank you
# 2  
Code:
log=$({
  cp /u02/xxc_incoming/TEST*.dat /u02/xxc_archive_incoming/AMER7764_ARPP_2/
  cat /u02/xxc_incoming/TEST*.dat > /u02/xxc_incoming/XXC_TEST.dat
  rm /u02/xxc_incoming/TEST*.dat
} 2>&1) || echo "$log" | mutt -s "ERROR" Mist123@google.com

This User Gave Thanks to nezabudka For This Post:
# 3  
Thank you so much Smilie
I have written like below(total code).

Code:
#!/bin/bash

log=$({
  cp /u02/xxc_incoming/TEST*.dat /u02/xxc_archive_incoming/AMER7764_ARPP_2/
  cat /u02/xxc_incoming/TEST*.dat > /u02/xxc_incoming/XXC_TEST.dat
  rm /u02/xxc_incoming/TEST*.dat
} 2>&1) || echo "$log" | mutt -s "ERROR" Mist123@google.com
cd $XXC_TOP/bin
sqlldr userid=apps/<pwd>  control=/u02/xxc/1.0/bin/XXC_INSERT.ctl rows=1
cat /u02/xxc_incoming/XXC_TEST.dat >> /u02/xxc_archive_incoming/AMER7764_ARPP_2/XXC_TEST.txt

sendmail: fatal: parameter inet_interfaces: no local interface found for ::1
Error sending message, child exited 75 (Deferred.).
Could not send the message.
SQL*Loader-500: Unable to open file (/u02/xxc/1.0/bin/XXC_INSERT.ctl)
SQL*Loader-553: file not found
SQL*Loader-509: System error: No such file or directory
# 4  
Hi @Mist123,
Use the email client that you have configured, maybe "mail"?
# 6  
Googling the sendmail error message, it looks like the latest "postfix" cannot start if IPv6 is not configured.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"
jcdole
Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing...... Shell Programming and Scripting
1
Shell Programming and Scripting
Using "mailx" command to read "to" and "cc" email addreses from input file
asjaiswal
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing To e-mail address and column 3 contains cc e-mail address to include with same email. Sample input file, email.txt Below is an sample code where...... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
how to send email using "mail" to google or yahoo
coolatt
hi all, i need to email the output of a command to a google or yahoo account. am using debian lenny 5. can someone please help me on this ?... UNIX for Advanced & Expert Users
5
UNIX for Advanced & Expert Users
Shell script: If a file stays in a particular directory more than 30 min send an email
muraliinfy04
Hi , I am new to shell scripting. i have a requirement say i will receive a file in a directory say /xyz.if that file stays in that directory more than 30 min i need to get a mail to my outlook.this should run for every 20 min in crontab. can anyone help me?... Shell Programming and Scripting
8
Shell Programming and Scripting

Featured Tech Videos