Revision of script from don

Don,

I revised script but when I ran it I did not receive any log. I am not sure what you mean to run it in code tags. I am using a putty session and ssh but I did not get a trace log?

Barb

---------- Post updated at 01:33 PM ---------- Previous update was at 01:27 PM ----------

This is what I revised and it still looped with no log

 #!/usr/bin/ksh
set -xv
 
ERRORDIR=/home/p611568/d2e/error_directory
 while read -r i
 do  RECIPIENTS="$RECIPIENTS $i@stryder.aessuccess.org"
 done < /home/p611568/d2e/xenos_scripts/emailparm] CODE
 
 RECIPIENTS=bcarosi
 
find /home/p611568/d2e/logs/*.rpt -mtime -10 ! -name '*ftplog*' | while read -r r1
# find /home/p611568/d2e/logs/*.rpt -mtime -8 ! -name '*ftplog*' | while read -r r1
 do  if grep -q CompletionCode "$r1"
     then
         if ! grep CompletionCode "$r1" | grep -q "CompletionCode: Value=0"
         then
             ( echo " There were errors in the following report file for Xenos:"
               echo
               echo "This files have been moved to $ERRORDIR"
               echo "$r1"
             ) | mail -s "$r1" $RECIPIENTS
             mv "$r1" "$ERRORDIR"
         fi
     fi
 done

It's posting in code tags, not "running".
And, did you get a mail from your run? If not, is bcarosi a valid mail destination on your host? If not, you should see messages in the mail system log. Correct the RECIPIENTS assignment.

1 Like

Use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, what operating system are you using?

Third, what is the name of your script?

Fourth, remove the space in front of #! on the first line of your script! And change the line in the script from:

 done < /home/p611568/d2e/xenos_scripts/emailparm] CODE

to:

 done < /home/p611568/d2e/xenos_scripts/emailparm

Then rerun your script.

Fifth, show us exactly what command you typed into your shell to run your script. (Please display this data in CODE tags as explained in the tutorial above.)

And, sixth, show us exactly what output your script wrote to your terminal when you ran your script? (Please display this data in CODE tags as explained in the tutorial above.)