Time rsYnc Machine (tym)

M. Carrasco ca at dragoman.org
Thu Jul 26 15:56:04 MDT 2012


Joe,

You know programmers are not very good at documenting :-)

On 26 Jul 2012, at 21:42, josephj at main.nc.us wrote:

> No good deed goes unpunished ;)
> 
> Very nicely coded script, but it's a bit dense.  I'm good at bash and can
> survive in rsync,

My intention was to make something readable :-) 

Main () {
 Init
 MakeDest
 Sync
 Bye 0
}

I will *try* to illustrate the code, but, please point to the most obscure bits and I will concentrate on it.

> but could you provide a description of what it actually
> does so I don't have to spend a long time analysing the code?

Similar functionalities to the Time Machine, though nothing for restoring: one has to use the available copy commands.

> Does it keep multiple versions like the name implies?

Yes. As indicated in
 http://dragoman.org/tym

"each run creates two yymmdd-hhmmss directories, one in the backup destination directory and one in the log directory"

Example
 - /foo/bar-dest (the data, using the hard link mechanism of rsync)
     120603-011102
     120616-091035
     120726-160744

 - ~./tym (the logs)
     120603-011102
     120616-091035
     120726-160744

Each log directory contain four files:
 log.txt    : then main log of Tim
 rsync.txt  : the output of rsync
 out.txt    : the standard output; should be empty
 err.txt    : the standard error; should be empty

The file log.txt 
1|0|start-time|08:46:54|
2|0|start-date|20-02-2012|
3|0|Prog|tym|
...
19|119|day:hour:minute:second|00:00:01:59|
20|119|end-date|20-02-2012|
21|119|end-time|08:48:53|

Where the fields are:
 sequential number
 seconds into the program
 key
 value

> Will it survive directory names with embedded blanks (in the parameters)?

Probably not. The variable SourceList should contain strings that survive Linux and rsync

 rsync ... $SourceList

> Why trap so many signals?  If something goes wrong, do I have to kill -9
> to stop it?

I trap all the signals because I want to know all the signals received. If tym receives a signal it log it in log.txt and continue; it might be changed to do something else.

I was considering changing it, so one could kill it with SIGTERM; the PID could be logged into log.txt.

> Does one of those keep it running when you logoff?  I don't see a nohup in
> the script.

It will keep running after logoff as SIGHUP is also trapped.

> I've seen some methods that use hard links to make subsequent backups
> smaller.  I haven't quite figured out how that works, but it doesn't look
> like you use it.

The hard work is done by rsync; tym is just a wrap. Indeed, it should not be too hard to implement it in rsync
 "One might consider implementing time machines facilites in rsync: --tm-source --tm-dest --tm-logdir --tm-machine"


> What does your script do if the destination runs out of space or isn't
> mounted?

It will fail and the errors registered in the appropriate logs.

Regards
Tomas

> TIA
> Joe
> 
>> http://dragoman.org/tym
>> 
>> Regards
>> Tomas
>> --
>> Please use reply-all for most replies to avoid omitting the mailing list.
>> To unsubscribe or change options:
>> https://lists.samba.org/mailman/listinfo/rsync
>> Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
>> 
> 
> 



More information about the rsync mailing list