Solara_14
asked on
Red Hat Enterprise Linux Server release 5.7 (Tikanga) - Script not sending email
The following is an extract of the script which is failing to send the email.
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
TXTERROR=/home/oracle/dba/ scripts/te xt_error.t xt
cd /home/oracle/dba/logs/
ATTFILE=$ARCOUTFD
SUBJECT="Errors removing archives"
MAILTO=mail@mail.com
PARAM1=$(egrep -i -c "ORA-|rejected|Killed|skip ped|RMAN-" "$ARCOUTFD")
PARAM2=$(egrep -c "Server status" "$ARCOUTFD")
PARAM3=$(egrep -c "Server status = 0" "$ARCOUTFD")
if [[ $PARAM1 -gt 0 || $PARAM2 -ne $PARAM3 ]] ; then
(cat $TXTERROR;uuencode $ATTFILE Archive_log_error.log|mail x -m -s "$SUBJECT" $MAILTO)
fi
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
TXTERROR=/home/oracle/dba/
cd /home/oracle/dba/logs/
ATTFILE=$ARCOUTFD
SUBJECT="Errors removing archives"
MAILTO=mail@mail.com
PARAM1=$(egrep -i -c "ORA-|rejected|Killed|skip
PARAM2=$(egrep -c "Server status" "$ARCOUTFD")
PARAM3=$(egrep -c "Server status = 0" "$ARCOUTFD")
if [[ $PARAM1 -gt 0 || $PARAM2 -ne $PARAM3 ]] ; then
(cat $TXTERROR;uuencode $ATTFILE Archive_log_error.log|mail
fi
ASKER
Yes it is set. I only provide a extract of the script.
Well I also asked "What is the error you are getting" and did you look at the mail log in /var/log/maillog.
Also are you using postfix or sendmail?
Also are you using postfix or sendmail?
ASKER
Thank you savone.
As you indicated I searched on the /var/mail, and this are the errors:
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/oracle>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=oracle>
X-Cron-Env: <USER=oracle>
/home/oracle/dba/scripts/A RCHIVES/RM AN_ARCH_DE LETE.sh: line 51: uuencode: command not found
mailx: invalid option -- m
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
[-- sendmail-options ...]
mail [-iInNv] -f [name]
mail [-iInNv] [-u user]
As you indicated I searched on the /var/mail, and this are the errors:
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/oracle>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=oracle>
X-Cron-Env: <USER=oracle>
/home/oracle/dba/scripts/A
mailx: invalid option -- m
Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
[-- sendmail-options ...]
mail [-iInNv] -f [name]
mail [-iInNv] [-u user]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
uuencode: command not found
either it isn't found in the path or the sharutils package is not installed (yum install sharutils if it isn't there)
mailx: invalid option -- m
there is no m parameter (man mailx to see options)
ASKER
Checking.
ASKER
Thanks, it worked !
I received the email.
I received the email.
Also the variable $ARCOUTFD does not seem to be set.
check the /var/log/maillog also.