Image versioning system.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Shell > Image versioning system.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Image versioning system.  
alan@ugtv.org


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-13-06 10:54 PM

I'm trying to create an image versioning system.
Currently the way the system works is:
There is a live server and a backup server.
Every day every file on the live server is checked to see what is the
file's modification date.
The modification date is compared against the folder structure to see
if the file exists and if it is newer.  If the live server file is
newer it's copied to the bacup server.

For Instance
Live Server
Image001.jpg Modified 03-11-2006

Backup Server
Folder Image001
-->Folder March
-->Folder Day01
-->Image001.jpg Modified 03-01-2006
-->Folder Day05
-->Image001.jpg Modified 03-05-2006
-->Folder Day11
-->Image001.jpg Modified 03-11-2006

The problem is:
I need to be able to read the modification date from the file using a
UNIX shell script.  (It doesn't matter which shell.)  I've tried using
ls and AWK, but I can't find a way to express the ls timestamp in
YYYYMMDD terms.

If anyone else can think of a way around this, or a way to do this, I'm
all ears.  Sorry for the long explanation.






[ Post a follow-up to this message ]



    Re: Image versioning system.  
Kurt Swanson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-13-06 10:54 PM

alan@ugtv.org writes:
> I'm trying to create an image versioning system.
> Currently the way the system works is:
> There is a live server and a backup server.
> Every day every file on the live server is checked to see what is the
> file's modification date.
> The modification date is compared against the folder structure to see
> if the file exists and if it is newer.  If the live server file is
> newer it's copied to the bacup server.

> For Instance
> Live Server
> Image001.jpg Modified 03-11-2006

> Backup Server
> Folder Image001
>   -->Folder March
>     -->Folder Day01
>          -->Image001.jpg Modified 03-01-2006
>     -->Folder Day05
>          -->Image001.jpg Modified 03-05-2006
>     -->Folder Day11
>          -->Image001.jpg Modified 03-11-2006

> The problem is:
> I need to be able to read the modification date from the file using a
> UNIX shell script.  (It doesn't matter which shell.)  I've tried using
> ls and AWK, but I can't find a way to express the ls timestamp in
> YYYYMMDD terms.

> If anyone else can think of a way around this, or a way to do this, I'm
> all ears.  Sorry for the long explanation.

Why not just use rsync?  (Maybe there's something I'm missing)

Otherwise, gnu ls does have a -time-style option:  ls -l --time-style=+%y%m%
d
--
© 2006 Kurt Swanson AB





[ Post a follow-up to this message ]



    Re: Image versioning system.  
alan@ugtv.org


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-13-06 10:54 PM

Thanks for the response, I'll look into GNU.
In regards to the rsync, that won't work because we're trying to get a
version history started.  If we used rsync, it would just replace the
old with the new.






[ Post a follow-up to this message ]



    Re: Image versioning system.  
Kevin Rodgers


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-13-06 10:54 PM

Use rsync's -n option (aka --dry-run) to tell you what files need to be
updated.
--
Kevin Rodgers






[ Post a follow-up to this message ]



    Re: Image versioning system.  
Kurt Swanson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-13-06 10:54 PM

alan@ugtv.org writes:
> Thanks for the response, I'll look into GNU.
> In regards to the rsync, that won't work because we're trying to get a
> version history started.  If we used rsync, it would just replace the
> old with the new.

In it's base form, yes, but consider rsync's "--backup" and related options.
--
© 2006 Kurt Swanson AB





[ Post a follow-up to this message ]



    Re: Image versioning system.  
alan@ugtv.org


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-06 01:53 AM


Kurt Swanson wrote:
> alan@ugtv.org writes: 
>
> In it's base form, yes, but consider rsync's "--backup" and related optio=
ns.
> --
> =A9 2006 Kurt Swanson AB

Rsync works great, but I can't get it to run as a CRON job.
I wrote a script that grabs the last group of folder names in a list
and only backs those up.
Any help would be great on what I'm doing wrong.

#!/bin/bash
mkdir /Volumes/image/
mount_afp afp://username:password@192.168.0.100/Images/ /Volumes/image
j=3D`ls /Volumes/image/ | grep [0-9] | tail -5`
for k in $j
do
echo $k
rsync -vr --verbose --recursive --times --archive --backup
--backup-dir=3D"/Volumes/FireWire/Backup/`date +%Y%m%d`"
/Volumes/image/$k /Volumes/FireWire/$k
done
umount /Volumes/image






[ Post a follow-up to this message ]



    Re: Image versioning system.  
Kurt Swanson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-18-06 01:53 AM

alan@ugtv.org writes:
> Kurt Swanson wrote: 
[vbcol=seagreen] 
[vbcol=seagreen]
> Rsync works great, but I can't get it to run as a CRON job.
> I wrote a script that grabs the last group of folder names in a list
> and only backs those up.
> Any help would be great on what I'm doing wrong.

> #!/bin/bash
> mkdir /Volumes/image/
> mount_afp afp://username:password@192.168.0.100/Images/ /Volumes/image
> j=`ls /Volumes/image/ | grep [0-9] | tail -5`
> for k in $j
> do
> echo $k
> rsync -vr --verbose --recursive --times --archive --backup
> --backup-dir="/Volumes/FireWire/Backup/`date +%Y%m%d`"
> /Volumes/image/$k /Volumes/FireWire/$k
> done
> umount /Volumes/image

What is the symptom, i.e. what is going wrong?  Is there an error
message?
--
© 2006 Kurt Swanson AB





[ Post a follow-up to this message ]



    Re: Image versioning system.  
Bill Marcum


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-19-06 05:02 PM

On 17 Mar 2006 17:10:01 -0800, alan@ugtv.org
<alan@ugtv.org> wrote:
>
> Rsync works great, but I can't get it to run as a CRON job.
Maybe you need to use the full path, i.e. /usr/bin/rsync or
/usr/local/bin/rsync


--
If at first you fricasee, fry, fry again.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:31 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register