tym(1) tym(1) NAME tym - rsync time machine SYNOPSIS tym backup|help|man|mo|log|list|kill|del DESCRIPTION Time rsYnc Machine (tym) is a backup utility with the approach popular‐ ized by the Time Machine of Apple. Each run creates an incremental backup into a directory DestDir/yymmdd-hhmmss; the destination direc‐ tory DestDir contains a yymmdd-hhmmss for each run, and hence the time machine effect. To recover data, use the operating system programs such as cp; care should be taken to keep last accessed time, and simi‐ lar. The variable SourceList contains the files/directories to be backed-up. To achieve the incremental backup, tym sets the rsync --link-dest option to the last backup in DestDir; this instructs rsync to hardlink unchanged files from --link-dest to the new backup. Logs go into the directory LogDir/yymmdd-hhmmss. The string yymmdd- hhmmss is the run timestamp as year, month, day, hours, minutes and seconds; for each run, it is the same in the directories DestDir and LogDir. It is recommended to run tym in background; login out will not kill the process. From a design perspective, the rationale has been to make a bash script easy to read and modify. All is contained in one file, even the man page. OPTIONS backup Do a backup. help Help. man Man page. mo Monitor current run. log Show log of the current/last run. list List the back-ups. kill Kill current run. del Delete oldest run. SETUP Set the internal variables at the beginning of the file. Mandatory variables readonly SourceList=/foo/bar-source readonly DestDir=[bar@example.com:]/foo/bar-dest Optional variable readonly LogDir=/foo/bar-log DEFAULT Logs LogDir='~/.tym' FILES /foo/bar-dest Destination directory. The value of the variable DestDir. Each run creates one yymmdd-hhmmss run directory in DestDir. /foo/bar-dest/yymmdd-hhmmss Run destination directory; example: /foo/bar-dest/120228-163606 /foo/bar-log Logs directory. The value of the variable LogDir. Each run creates one yymmdd-hhmmss run directory in LogDir. /foo/bar-dest/yymmdd-hhmmss Run log directory; example: /foo/bar-dest/120228-163606 /foo/bar-log/yymmdd-hhmmss/log.txt The main tym log file. It contains four fields separated by '|': sequencial number, seconds into the process, key, value. /foo/bar-log/yymmdd-hhmmss/rsync.txt The output of rsync. /foo/bar-log/yymmdd-hhmmss/out.txt The standard output; it should be empty. /foo/bar-log/yymmdd-hhmmss/err.txt The standard error; it should be empty. /foo/bar-log/yymmdd-hhmmss/del.txt Deleted backup log. It contains one line with two fields sepa‐ rated by '|': time of the deletion and full path of the deleted backup. EXIT VALUES Less than 40: the same meaning as rsync. 40 : wrong number of options. 41 : unknown option. 50 : fatal error - bad store directory. 51 : signal ERR. 52 : signal 15. 61 : sentinel 1; error in the program. 62 : sentinel 2; error in the program. 63 : sentinel 3; error in the program. EXAMPLES Doing a back-up tym backup & Monitor progress tym mo Run directories (yymmdd-hhmmss) The command tym executed on 16:32:06 28 February 2012 created one run directory in each of the DestDir and LogDir directories, with the for‐ mat 120228-163606. One item for back-up readonly SourceList=/foo/bar-source Several items for back-up readonly SourceList=' /foo/bar /baz/foo ' Destination directory readonly DestDir=/foo/bar-dest # it must contain only one directory name Log directory readonly LogDir=/foo/bar-log # it must contain only one directory name NOTES Lastest version http://dragoman.org/tym Parameters tym could be changed to accept the parameters SourceList, DestDir and LogDir in other ways. Examples: - configuration file tymconf - environmet variables tym_src, tym_dest, tym_log Internal rsync time machine One might consider implementing time machine functionalities into rsync: rsync ... --tm-source --tm-dest [--tm-log] AUTHOR M.T. Carrasco Benitez WARNINGS When using a remote machine, ssh and rsync each request the remote machine password; use ~/.ssh keys to avoid password prompting. Without the keys, it cannot be run in background. -H (hardlinks preservation) is not used and "Without this option, hard- linked files in the transfer are treated as though they were separate files" [rsync man page]. -H might conflict with --link-dest. To add hardlinks, in the function Sync change the string -azhq to -azhqH. Simultaneous execution of more than one tym run with the same parame‐ ters would probably have unintended results. A locking mechanism might be considered. BUGS The content of SourceList must be rsync and Linux safe as it goes into the command line. Files and directories with blanks and similar char‐ acter would probably not work. The rsync command line is something like: rsync ... $SourceList REPORTING BUGS ca AT dragoman DOT org COPYRIGHT Copyright © 2012 M.T. Carrasco Benitez. License EUPL. Use at your own risk. SEE ALSO rsync(1), rsyncd.conf(5), ssh(1) version 4 27 October 2012 tym(1)