Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Echo-out the command that will be executed.
- #echo /usr/bin/sa-learn -D $* /tmp/sendmail-msg-$$.txt
- # Add "starting now" string to log.
- echo "$$-start ($*)" >> /tmp/sa-learn-pipe.log
- # Copy the message contents to a temporary text file.
- #echo $* > /tmp/sendmail-parms.txt
- cat<&0 >> /tmp/sendmail-msg-$$.txt
- CURRENT_USER=$(whoami)
- echo "Calling (as user $CURRENT_USER) '/usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt'" >> /tmp/sa-learn-pipe.log
- # Execute sa-learn, with the passed ham/spam argument, and the temporary message contents.
- # Send the output to the log file while redirecting stderr to stdout (so we capture debug output).
- /usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt >> /tmp/sa-learn-pipe.log 2>&1
- # Remove the temporary message.
- rm -f /tmp/sendmail-msg-$$.txt
- # Add "ending now" string to log.
- echo "$$-end" >> /tmp/sa-learn-pipe.log
- # Exit with "success" status code.
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement