[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A quick question about scripting
- To: misc_(_at_)_openbsd_(_dot_)_org
- Subject: Re: A quick question about scripting
- From: Jason Opperisano <opie_(_at_)_817west_(_dot_)_com>
- Date: Thu, 02 Sep 2004 10:22:01 -0400
On Thu, 2004-09-02 at 09:58, Tomas wrote:
> I know you all know better ways to do this :) but this is my first UNIX
> script, so please don't laught :)
>
> Here's my script:
>
> <----->
>
> #!/bin/sh
>
> #
>
> sendmail -bd && cd /var/log/ && gunzip maillog.6.gz && more maillog.6 | mail
> -s Test my_(_at_)_mail \
>
> .lt && rm maillog.6 && kill -HUP `head -n 1 /var/run/sendmail.pid`
>
> <----->
>
> Everything works fine, but I don't get my mail because sendmail doesn't make
> it in time to send mail before it gets killed ( if I don't kill sendmail, I
> get my mail )
>
> So I have two questions about this script:
>
> Is there a way to make my script to sleep for a short time?
sleep <number of seconds>
you can also use zmore/zcat instead of your "gunzip && more" construct
> Is there a way to atach maillog.6.gz file to a mail and send it gziped?
uuencode maillog.6.gz maillog.6.gz | mail ...
-j
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
There's no easy quick way out, we're gonna have to live through our
whole lives, win, lose, or draw. -- Walt Kelly
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Visit your host, monkey.org