Skip to content

Commit

Permalink
Added sftp-examples to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
kdargel committed Mar 5, 2019
1 parent 6c3a96b commit 161992e
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,41 @@ $ docker build --build-arg VERSION=$RCLONE_VERSION -t rclone .
```

# Usage
Besides `rclone` this container also features `inotify`.
`Rclone` is defined generically through the container environment.
To find the name of the environment variable, first, take the long option name,
strip the leading --, change - to _ make upper case and prepend RCLONE_.
All available endpoints are described in the [official rclone documentation](https://rclone.org/commands/rclone_move/)
of each command.
### Run `rclone` (default entrypoint)
```bash
$ docker run --rm -it travelping/rclone:latest --help
```

### Run `rclone` (sftp)
This configuration provides a simple functionality test by enhancing the default entrypoint (`usr/bin/rclone`).
Running a touch command on the remote path of a sftp server can be done entirely through environment.
```bash
docker run --rm -it -e RCLONE_CONFIG_SFTP_TYPE=sftp \
-e RCLONE_CONFIG_SFTP_HOST=host.com \
-e RCLONE_CONFIG_SFTP_USER=name \
-e RCLONE_CONFIG_SFTP_PORT=23 \
-e RCLONE_CONFIG_SFTP_PASS=mSZyspHocI375S3V7OupBbljCpqSnhD6 travelping/rclone:v1.0 touch sftp:path
```

### Run shell
```bash
$ docker run --rm -it --entrypoint=/bin/sh travelping/rclone:latest
```


## Debugging
## Inotify
Besides `rclone` this container also features `inotify`. Watchpatterns can be used to make sure only finished files
are being transfered.
All inotify-events can be neatly logged using this command:
```
inotifywait -mr --timefmt '%H:%M' --format '%T %w %e %f' /data/"
```

## Script

## Inotify-Script
Wating for the `close_write` event, this command only pushes "finished" data to the destination.
```
watchnames=''
Expand All @@ -33,11 +48,6 @@ inotifywait --monitor -e close_write --format %w%f $watchnames | while read FILE
do
echo "$FILE is finished. Moving to data/finished/"
mv $FILE/ data/finished/
rclone move /data/finished/ onedrive:data/
rclone move /data/finished/ sftp:data/
done
```

Endpoints checked:
- [x] SFTP
- [X] Onedrive
- [ ] S3

0 comments on commit 161992e

Please sign in to comment.