LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-30-2009, 03:02 AM   #1
vwal
LQ Newbie
 
Registered: Aug 2009
Location: North Texas
Distribution: CentOS, FreeBSD (yeah, not a Linux :-)
Posts: 6

Rep: Reputation: 0
Question Continuous / On-change backup of a directory?


What is the best way to monitor and back up a directory (and its sub directories) based on changes? Fam and inotify (and Gamin?) are often mentioned in this context, but they provide programming interfaces. I'm rather looking for an application software (that would likely utilize one of those APIs) that I could simply set up as a daemon and point to a directory which to monitor and to duplicate to a target location. It would also preferably have versioning (i.e. e.g. "keep the 25 most recent copies of each file").

On Windows side apps such as ViceVersa with its associated service, VVEngine do the same... but I need similar functionality on my Linux dev server (running CentOS 5.3) and so the Windows apps are of little use there.

Thanks for any insights/advise on this!
 
Old 08-30-2009, 07:48 PM   #2
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 128Reputation: 128
Solaris ZFS is probably the best tool to do that but Ubuntu TimeVault and some other backup system can also work.
 
Old 08-30-2009, 08:07 PM   #3
vwal
LQ Newbie
 
Registered: Aug 2009
Location: North Texas
Distribution: CentOS, FreeBSD (yeah, not a Linux :-)
Posts: 6

Original Poster
Rep: Reputation: 0
I've been looking into this more. inotify-based iWatch is the most promising setup I've come across thus far. It has the option to execute a command when a change occurs and it provides the command full path to the changed file as an argument. It should be fairly easy to script a versioned copy with that information even as a shell script, and certainly with Python or Perl. Or, perhaps a versioned copy utility exists already (haven't researched it yet) which the output from iWatch could be piped to.
 
Old 08-30-2009, 08:26 PM   #4
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 128Reputation: 128
It is what TimeVault and ZFS (mentionned in my earlier post) does. But perhaps you are for a SVN server trigered by your iWatch?

Last edited by Elv13; 08-30-2009 at 08:27 PM.
 
Old 08-30-2009, 10:08 PM   #5
vwal
LQ Newbie
 
Registered: Aug 2009
Location: North Texas
Distribution: CentOS, FreeBSD (yeah, not a Linux :-)
Posts: 6

Original Poster
Rep: Reputation: 0
My understanding of TimeVault is that it takes "snapshots" of the filesystem; it might be too "heavy duty" for the intended use. Basically what I'm thinking about is to have a working copy checked out of SVN in a directory that would be monitored by inotify. That way while files are be worked on, several historical copies would be maintained in a separate directory (outside of the development area) so that when, say, I mess up the code I'm currently working on I could step backwards a save or two with little effort simply by picking up a slightly older copy from the backup folder. Commits to SVN would only happen when the code is actually working. With TimeVault my concern here is that obtaining copy of a file that was saved few minutes ago might be too much effort. The versioning for currently worked on items I'm looking for here is pretty casual, and it's mainly intended to prevent situations such as where one spends an hour hunting an inadvertendly introduced extra quote in a large JavaScript file. Many IDEs such as Zend Studio or even UEStudio of course provide "keep x previous copies" which might suffice.. except that I would like to keep the versioning tool-independent.

However, your suggestion for automatic commits to SVN based on an iWatch trigger might do the trick! It would certainly take care of versioning; the in-progress code could be always stored in a fork as not to pollute the trunk. In the past I had a reverse setup where I did a commit to SVN (or at that time to CVS) on every change/save, and a script then updated a working copy in the web directory. But that was a pain to work with as there was always a 4-6 second delay before the change would be reflected in the web folder and so in the browser refresh. If commits to SVN would be triggered by an iWatch event, it would occur independently from server side debugging (I'll use this this with zend server) and browser update. The only consideration would be configuration files and such which I would ultimately not want to commit to the trunk, but perhaps they could be pruned during the fork merge process.

I'll give this a try, and update this thread later. More ideas/thoughts are of course welcome!
 
Old 08-31-2009, 01:44 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
There's a small package called inotify-tools that can be used in command line. Example:

Code:
inotifywait /tmp --event create --event modify --monitor --format %f | while read file; do echo "$file"; done
 
Old 08-31-2009, 02:13 AM   #7
vwal
LQ Newbie
 
Registered: Aug 2009
Location: North Texas
Distribution: CentOS, FreeBSD (yeah, not a Linux :-)
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks! Also incron (from inotify folks) might work as the svn commit trigger. Need to test these alternatives this week.
 
  


Reply

Tags
automatic, backup, directory, monitoring


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change default vsftp anonymous accout directory /var/ftp to other directory? hocheetiong Linux - Newbie 2 01-24-2010 06:33 PM
help with compressing a directory for backup Lleb_KCir Linux - Newbie 8 10-28-2005 02:52 AM
Backup of directory sanjibgupta Linux - Networking 2 09-05-2005 12:32 AM
backup from directory with spaces dennis_89 Linux - Networking 7 06-21-2004 10:14 PM
mountig - change ro to rw, delete directory, change rw to ro ?? itsjustme Linux - General 6 10-17-2003 11:48 AM


All times are GMT -5. The time now is 11:19 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration