public inbox for gentoo-server@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-server] Scripting fun
@ 2008-06-10  2:59 JD Gray
  2008-06-10  3:21 ` RijilV
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: JD Gray @ 2008-06-10  2:59 UTC (permalink / raw
  To: gentoo-server

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" kahdgarxi@gmail.com;
fi

Thanks in advance

-JD
-- 
gentoo-server@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  2:59 [gentoo-server] Scripting fun JD Gray
@ 2008-06-10  3:21 ` RijilV
  2008-06-10  3:39 ` W.Kenworthy
  2008-07-01  2:10 ` Korthrun
  2 siblings, 0 replies; 8+ messages in thread
From: RijilV @ 2008-06-10  3:21 UTC (permalink / raw
  To: gentoo-server

echo "$CHECK_RESULT" | /bin/mail -s "$HOSTNAME glsa-check" root@yourbox.com

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 <kahdgarxi@gmail.com>:
> 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" kahdgarxi@gmail.com;
> fi
>
> Thanks in advance
>
> -JD
> --
> gentoo-server@lists.gentoo.org mailing list
>
>
-- 
gentoo-server@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  2:59 [gentoo-server] Scripting fun JD Gray
  2008-06-10  3:21 ` RijilV
@ 2008-06-10  3:39 ` W.Kenworthy
  2008-06-10  3:52   ` Francisco Ares
  2008-06-10  3:53   ` W.Kenworthy
  2008-07-01  2:10 ` Korthrun
  2 siblings, 2 replies; 8+ messages in thread
From: W.Kenworthy @ 2008-06-10  3:39 UTC (permalink / raw
  To: gentoo-server

Put something like this in [f]crontab:

%daily,lavg(1.5,2,2) * 3-9 root rsync --recursive --links --safe-links
--perms --times --compress --force --whole-file --delete --delete-after
--stats --timeout=180
rsync://rsync.gentoo.org/gentoo-portage/metadata/glsa/* /usr/portage/metadata/glsa/ ;glsa-check -n -l|grep "\[N";glsa-check -t all

glsa-check only does its magic on the current portage snapshot - the
above line rsyncs just the security stuff first.  Once done, get cron to
mail it as here.

BillK


On Mon, 2008-06-09 at 19:59 -0700, JD Gray wrote:
> 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" kahdgarxi@gmail.com;
> fi
> 
> Thanks in advance
> 
> -JD
-- 
gentoo-server@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  3:39 ` W.Kenworthy
@ 2008-06-10  3:52   ` Francisco Ares
  2008-06-10  4:15     ` Marius Mauch
  2008-06-10  3:53   ` W.Kenworthy
  1 sibling, 1 reply; 8+ messages in thread
From: Francisco Ares @ 2008-06-10  3:52 UTC (permalink / raw
  To: gentoo-server

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Check this:

http://gentoo-wiki.com/SECURITY_Getting_GLSAs_by_Email

Hope it helps
Francisco

-- 
"If you have an apple and I have an apple and we exchange apples then you
and I will still each have one apple. But if you have an idea and I have one
idea and we exchange these ideas, then each of us will have two ideas." -
George Bernard Shaw

[-- Attachment #2: Type: text/html, Size: 458 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  3:39 ` W.Kenworthy
  2008-06-10  3:52   ` Francisco Ares
@ 2008-06-10  3:53   ` W.Kenworthy
  1 sibling, 0 replies; 8+ messages in thread
From: W.Kenworthy @ 2008-06-10  3:53 UTC (permalink / raw
  To: gentoo-server

oops - pulled that from an old system - at the end just use:

";glsa-check -vt all"

The first run with grep is redundant - possibly worked with the first
glsa-check versions ...

BillK



On Tue, 20 08-06-10 at 11:39 +0800, W.Kenworthy wrote:
> Put something like this in [f]crontab:
> 
> %daily,lavg(1.5,2,2) * 3-9 root rsync --recursive --links --safe-links
> --perms --times --compress --force --whole-file --delete --delete-after
> --stats --timeout=180
> rsync://rsync.gentoo.org/gentoo-portage/metadata/glsa/* /usr/portage/metadata/glsa/ ;glsa-check -n -l|grep "\[N";glsa-check -t all
> 
> glsa-check only does its magic on the current portage snapshot - the
> above line rsyncs just the security stuff first.  Once done, get cron to
> mail it as here.
> 
> BillK
> 
> 
> On Mon, 2008-06-09 at 19:59 -0700, JD Gray wrote:
> > 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" kahdgarxi@gmail.com;
> > fi
> > 
> > Thanks in advance
> > 
> > -JD
-- 
gentoo-server@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  3:52   ` Francisco Ares
@ 2008-06-10  4:15     ` Marius Mauch
  2008-07-16 14:13       ` A. Khattri
  0 siblings, 1 reply; 8+ messages in thread
From: Marius Mauch @ 2008-06-10  4:15 UTC (permalink / raw
  To: gentoo-server

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On Tue, 10 Jun 2008 00:52:01 -0300
"Francisco Ares" <frares@gmail.com> wrote:

> Check this:
> 
> http://gentoo-wiki.com/SECURITY_Getting_GLSAs_by_Email
> 

Or just use `glsa-check --mail affected` ;)

Marius

-- 
Public Key at http://www.genone.de/info/gpg-key.pub

In the beginning, there was nothing. And God said, 'Let there be
Light.' And there was still nothing, but you could see a bit better.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  2:59 [gentoo-server] Scripting fun JD Gray
  2008-06-10  3:21 ` RijilV
  2008-06-10  3:39 ` W.Kenworthy
@ 2008-07-01  2:10 ` Korthrun
  2 siblings, 0 replies; 8+ messages in thread
From: Korthrun @ 2008-07-01  2:10 UTC (permalink / raw
  To: gentoo-server

On Mon, Jun 9, 2008 at 7:59 PM, JD Gray <kahdgarxi@gmail.com> wrote:
> 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" kahdgarxi@gmail.com;
> fi
>
> Thanks in advance
>
> -JD
> --
> gentoo-server@lists.gentoo.org mailing list
>
>
echo $CHECK_RESULT | sed -e 's/\n/\r\n/' | /bin/mail -s "Frog
glsa-check" kahdgarxi@gmail.com

Might make that work how you'd expect.


-- 
() The ASCII Ribbon Campaign - against HTML Email,
/\ vCards, and proprietary formats.
-- 
gentoo-server@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-server] Scripting fun
  2008-06-10  4:15     ` Marius Mauch
@ 2008-07-16 14:13       ` A. Khattri
  0 siblings, 0 replies; 8+ messages in thread
From: A. Khattri @ 2008-07-16 14:13 UTC (permalink / raw
  To: gentoo-server

On Tue, 10 Jun 2008, Marius Mauch wrote:

> Or just use `glsa-check --mail affected` ;)

Or use glcu.


-- 
A
-- 
gentoo-server@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-16 16:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10  2:59 [gentoo-server] Scripting fun JD Gray
2008-06-10  3:21 ` RijilV
2008-06-10  3:39 ` W.Kenworthy
2008-06-10  3:52   ` Francisco Ares
2008-06-10  4:15     ` Marius Mauch
2008-07-16 14:13       ` A. Khattri
2008-06-10  3:53   ` W.Kenworthy
2008-07-01  2:10 ` Korthrun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox