Aaron Crosman on 13 Sep 2004 13:28:01 -0000


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

Re: [PLUG] Getting only today's logs


Switching the format was the answer, but it still didn't like YYYY-MM-DD.  I
shouldn't have specified a date here at all. I changed first line to:
now=$(date)
And everything fell into place (well once the date file was updated).  I'm
not only getting the logs that have changed since the last time I ran the
script.

Thanks for the help.
Aaron

> From: Walt Mankowski <waltman@pobox.com>
> Reply-To: <plug@lists.phillylinux.org>
> Date: Fri, 10 Sep 2004 17:03:58 -0400
> To: <plug@lists.phillylinux.org>
> Subject: Re: [PLUG] Getting only today's logs
> 
> I haven't tried it, but looking at the docs for tar it appears that it
> doesn't like the YYYYMMDD format.  Try using YYYY-MM-DD instead.
> 
> Walt
> 
> On Fri, Sep 10, 2004 at 04:26:48PM -0400, Aaron Crosman wrote:
>> I am trying to write a script that will copy files from our remote
>> debian web server to a local SuSE server that processes web logs for
>> stats.  For obvious reasons I only want to copy the new files.  Most of
>> the script works great.  I can connect the to remote, run the commands
>> below, scp the resulting tar.gz file to the local server and decompress
>> them in desired directory.  It's the creation of the tar file that seems
>> to be giving me trouble.  It always copies all the files, not just the
>> new ones.  Can someone please tell me what I'm missing?
>> 
>> Thanks
>> Aaron
>> 
>> =============== Bash Commands executed on remote host follow
>> ====================
>> 
>> # Get the new date
>> now=$(date +%Y%m%d)
>> 
>> # Get the previous Date
>> prev=$(cat date.logs.dump)
>> 
>> # Remove the old tar file
>> rm ~/siteLogs.tar.gz
>> 
>> # create the new tar file
>> tar -czf ~/siteLogs.tar.gz --after-date="$prev"  /www/sitelogs
>> 
>> # save the date
>> echo $now > date.logs.dump
>> ___________________________________________________________________________
>> Philadelphia Linux Users Group         --        http://www.phillylinux.org
>> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
>> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>> 



___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug