I've written a code where it will check the successful execution of the last run command and will mail the output with the subject.
#!/bin/ksh
SCHEDULER ID="abc123"
RUNNUM_INFO="1212"
DATE=`date '+%Y%m%d'`
FILE="OX_{DATE}.txt"
/usr/bin/ftp -n 93.179.136.9 << !EOF!
user abc passwd
cd "/0009/Codici Migrazione"
bin
get $FILE
bye
!EOF!
if [ $? -eq 0 ];
then
echo "Activity completed. \n
SCHEDULER ID : $SCHEDULE_ID \n BILL_RUN_NUM: $BILL_RUNNUM_INFO \n DATE: $DATE" | mailx -r "[email protected]" -s "Activity Completed - $DATE"
exit 0
fi
But, on executing the script, I'm getting error:
The flags you gave are used only when sending mail.