Link to home
Start Free TrialLog in
Avatar of Solara_14
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/text_error.txt
cd /home/oracle/dba/logs/
ATTFILE=$ARCOUTFD
SUBJECT="Errors removing archives"
MAILTO=mail@mail.com
PARAM1=$(egrep -i -c "ORA-|rejected|Killed|skipped|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|mailx -m -s "$SUBJECT" $MAILTO)
fi
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

What is the error?

Also the variable $ARCOUTFD does not seem to be set.

check the /var/log/maillog also.
Avatar of Solara_14
Solara_14

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?
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/ARCHIVES/RMAN_ARCH_DELETE.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]
ASKER CERTIFIED SOLUTION
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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)
Checking.
Thanks, it worked !
I received the email.