Skip to content

Commit

Permalink
Merge pull request #38 from cytopia/release-0.9
Browse files Browse the repository at this point in the history
Release v0.9
  • Loading branch information
cytopia authored Mar 29, 2020
2 parents 0fd4586 + fbd838a commit 3e1498b
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 37 deletions.
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# EditorConfig is awesome: https://EditorConfig.org

# -------------------------------------------------------------------------------------------------
# Default configuration
# -------------------------------------------------------------------------------------------------
# top-most EditorConfig file
root = true

# Default for all files
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[.sh}]
indent_style = tab
indent_size = 4

[Makefile]
indent_style = tab
indent_size = 4

[*.md]
indent_style = space
trim_trailing_whitespace = false
indent_size = 2
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Changelog


## Release v0.9

#### Added
- [#9](https://github.com/cytopia/linux-timemachine/issues/9) Be able to backup to remote SSH host
- Add debug option
- Editorconfig


## Release v0.8

#### Changed
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ test:
@echo "# -------------------------------------------------------------------- #"
@echo
@$(MAKE) _populate
@if ! ./timemachine -v $(SRC) $(DST) 3>&1- 1>&2- 2>&3- | grep -E '.+'; then \
@if ! ./timemachine -d $(SRC) $(DST) 3>&1- 1>&2- 2>&3- | grep -E '.+'; then \
printf "[TEST] [OK] No warnings detected for run without rsync arguments.\r\n"; \
else \
printf "[TEST] [FAIL] Warnings detected in stderr for run without rsync arguments.\r\n"; \
exit 1; \
fi
@sleep 2
@if ! ./timemachine -v $(SRC) $(DST) 3>&1- 1>&2- 2>&3- | grep -E '.+'; then \
@if ! ./timemachine -d $(SRC) $(DST) 3>&1- 1>&2- 2>&3- | grep -E '.+'; then \
printf "[TEST] [OK] No warnings detected for run without rsync arguments.\r\n"; \
else \
printf "[TEST] [FAIL] Warnings detected in stderr for run without rsync arguments.\r\n"; \
Expand All @@ -99,7 +99,7 @@ test:
@echo "# -------------------------------------------------------------------- #"
@echo
@$(MAKE) _populate
@if ./timemachine -v $(SRC) $(DST); then \
@if ./timemachine -d $(SRC) $(DST); then \
printf "[TEST] [OK] Run timemachine without rsync arguments.\r\n"; \
else \
printf "[TEST] [FAIL] Run timemachine without rsync arguments.\r\n"; \
Expand Down Expand Up @@ -155,7 +155,7 @@ test:
@echo "# -------------------------------------------------------------------- #"
@echo
@$(MAKE) _populate
@if ./timemachine -v $(SRC) $(DST) -- --progress; then \
@if ./timemachine -d $(SRC) $(DST) -- --progress; then \
printf "[TEST] [OK] timemachine with rsync arguments.\r\n"; \
else \
printf "[TEST] [FAIL] timemachine with rsync arguments.\r\n"; \
Expand Down
45 changes: 35 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

This shell script mimics the behavior of OSX's timemachine.
It uses [rsync](https://linux.die.net/man/1/rsync) to incrementally back up your data to a different
directory or hard disk. All operations are incremental, atomic and automatically resumable.
directory, hard disk or remote server via SSH. All operations are incremental, atomic and automatically resumable.

By default it uses `--recursive`, `--perms`, `--owner`, `--group`, `--times` and `--links`.
In case your target filesystem does not support any of those options or you cannot use them due
Expand All @@ -35,18 +35,28 @@ sudo make uninstall
Using [POSIX.1-2008](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html) argument syntax:

```bash
# Recursive, incremental and atomic backup
# Recursive, incremental and atomic backup (locally)
$ timemachine /source/dir /target/dir

# Recursive, incremental and atomic backup (via ssh)
$ timemachine /source/dir user@host:target/dir

# Recursive, incremental and atomic backup (via ssh with non-standard port)
$ timemachine --port 10000 /source/dir user@host:target/dir

# Append rsync options
$ timemachine /source/dir /target/dir -- --specials --progress
$ timemachine /source/dir /target/dir -- --specials --perms
$ timemachine /source/dir /target/dir -- --specials --no-perms
$ timemachine /source/dir /target/dir -- --archive --progress

# Make the timemachine script be more verbose
$ timemachine -v /source/dir /target/dir
$ timemachine --verbose /source/dir /target/dir

# Make the timemachine script be even more verbose
$ timemachine -d /source/dir /target/dir
$ timemachine --debug /source/dir /target/dir

# Make the timemachine script and rsync more verbose
$ timemachine -v /source/dir /target/dir -- --verbose
$ timemachine --verbose /source/dir /target/dir -- --verbose
Expand All @@ -55,6 +65,10 @@ $ timemachine --verbose /source/dir /target/dir -- --verbose

## Features

#### SSH or local

Local backups as well as backups via SSH are supported.

#### Incremental

Backups are always done incrementally using rsync's ability to hardlink to previous backup directories. You can nevertheless always see the full backup on the file system of any incrementally made backup without having to generate it. This will also be true when deleting any of the previously created backup directories. See the [Backups](#backups) section for how this is achieved via rsync.
Expand Down Expand Up @@ -124,28 +138,34 @@ There will be a directory `.inprogress/` in your specified destination. This wil
```
$ timemachine -h
Usage: timemachine [-v] <source> <destination> -- [rsync opts]
Usage: timemachine [-vd] <source> <dest> -- [rsync opts]
timemachine [-vd] <source> <host>:<dest> -- [rsync opts]
timemachine [-vd] <source> <user>@<host>:<dest> -- [rsync opts]
timemachine -V
timemachine -h
This shell script mimics the behavior of OSX's timemachine.
It uses rsync to incrementally back up your data to a different directory.
It uses rsync to incrementally back up your data to a different directory or remote server via SSH.
All operations are incremental, atomic and automatically resumable.
By default it uses --recursive --perms --owner --group --times --links.
In case your target filesystem does not support any of those options, you can explicitly
disable those options via --no-perms --no-owner --no-group --no-times and --copy-links.
Required arguments:
<source> Source directory
<destination> Destination directory. Can also be a remote server
<source> Source directory
<dest> Destination directory.
<host>:<dest> SSH host and destination directory
<user>@<host>:<dest> SSH user, SSH host and destination directory
Options:
-v, --verbose Be verbose.
-p, --port Specify alternative SSH port for remote backups if it is not 22.
-v, --verbose Be verbose.
-d, --debug Be even more verbose.
Misc Options:
-V, --version Print version information and exit
-h, --help Show this help screen
-V, --version Print version information and exit
-h, --help Show this help screen
Examples:
Simply back up one directory recursively
Expand All @@ -163,6 +183,11 @@ Examples:

## Troubleshooting

### Non-standard SSH port
```
$ timemachine --port 1337 src/ user@host:path/to/backup
```

### Disable preserving owner and group
```bash
$ timemachine src/ dst/ -- --no-owner --no-group
Expand Down
Loading

0 comments on commit 3e1498b

Please sign in to comment.