Aaron Crosman on 10 Sep 2004 20:27:03 -0000

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

[PLUG] Getting only today's logs

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?


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