Hi Tom,
After doing above changes, I executed my script
from server. All went fine and mail was received too.
Here are logs:
Executing While loop now...
While loop ends.Doing unnencode
unnencode done. Sending mail...
mail sent
Here is size of tmp1:
myserver:DB$ ls -ltr /tmp/tmp1
-rw-r--r-- 1 oracle oinstall 24539 Jan 30 08:23 /tmp/tmp1
myserver:DB$
But when I executed same script from
Oracle job, all went fine but /tmp/tmp1 has 0 size, & hence no mail received:
SQL> exec DBMS_SCHEDULER.RUN_JOB ( 'GEN_DAILY_CNT_FILE' );
PL/SQL procedure successfully completed.
SQL>
Here are the logs:
Executing While loop now...
While loop ends.Doing unnencode
unnencode done. Sending mail...
mail sent
myserver:DB$ ls -ltr /tmp/tmp1
-rw-r--r-- 1 oracle oinstall 0 Jan 30 08:27 /tmp/tmp1
myserver:DB$
And no mail was received.
FYI, here is my full shell script:
#!/bin/ksh
output=/u01/app/oracle/local/scripts/db_daily_table_cnt.log
output1=/u01/app/oracle/local/scripts/db_daily_table_cnt_f.log
rm $output
rm $output1
export ORACLE_SID=ORCL
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
$ORACLE_HOME/bin/sqlplus -s <<EOF
/ as sysdba
@/u01/app/oracle/local/scripts/db_daily_table_cnt.sql
exit;
EOF
echo "Executing While loop now..." > /u01/app/oracle/local/scripts/logging_temp.log
while IFS= read -r line
do
echo "$line" >> $output1
done < "$output"
echo "While loop ends.Doing unnencode" >> /u01/app/oracle/local/scripts/logging_temp.log
uuencode $output1 /u01/app/oracle/local/scripts/db_daily_table_cnt > /tmp/tmp1
echo "unnencode done. Sending mail..." >> /u01/app/oracle/local/scripts/logging_temp.log
mail -s "Test Mail" ankit.vohra1@gmail.com < /tmp/tmp1
echo "mail sent" >> /u01/app/oracle/local/scripts/logging_temp.log
Seems unnencode is not generating any output in tmp1 due to some reason.
Thanks