[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A quick question about scripting



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
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~