echo "$CHECK_RESULT" | /bin/mail -s "$HOSTNAME glsa-check" [EMAIL PROTECTED]

FWIW $HOSTNAME should be present in the standard environmnet, makes
the script a bit more protable if you use it.  Also, is there a reason
you're running the command twice?  Moreover, if you set it up as a
cronjob you could just let cron take care of emailing you if there is
any output, and suspress the output if glsa-check doesn't print
anything..

.r'


2008/6/9 JD Gray <[EMAIL PROTECTED]>:
> I'm running the below script on my gentoo servers to email me whenever
> there are GLSA's affecting me. It works like a charm, but I have one
> beef with it. Newlines are not preserved, so I get a lovely Wall Of
> Text (tm) when ever it sends me the GLSA. I'm guessing this is because
> of the way bash handles variables. Anyone have any insight on how to
> correct this?
>
> #!/bin/bash
>
> /usr/bin/glsa-check -t all &> /dev/null
> CHECK_RESULT="`/usr/bin/glsa-check -t all 2>&1`"
>
> if [ "$CHECK_RESULT" != "" ]; then
>  echo $CHECK_RESULT | /bin/mail -s "Frog glsa-check" [EMAIL PROTECTED];
> fi
>
> Thanks in advance
>
> -JD
> --
> gentoo-server@lists.gentoo.org mailing list
>
>
-- 
gentoo-server@lists.gentoo.org mailing list

Reply via email to