mirror of
https://github.com/simon987/beemer.git
synced 2025-04-21 08:46:41 +00:00
47 lines
1.8 KiB
Markdown
47 lines
1.8 KiB
Markdown
# beemer
|
||

|
||
[](https://ci.simon987.net/job/beemer_builds/)
|
||
[](https://www.codefactor.io/repository/github/simon987/beemer)
|
||
|
||
**beemer** executes a custom command on files written in the watched directory and deletes it.
|
||
|
||
### Usage
|
||
|
||
```
|
||
NAME:
|
||
beemer - Execute a command on a file after a delay of inactivity
|
||
|
||
GLOBAL OPTIONS:
|
||
--command value, -c value Will be executed on file write. You can use %file and %dir. Example: "rclone move %file remote:/beem/%dir"
|
||
--wait DELAY, -w DELAY Files will be beemed after DELAY of inactivity (default: 10s)
|
||
--directory DIRECTORY, -d DIRECTORY DIRECTORY to watch. If non-empty, its current files & subdirectories will be ignored
|
||
--help, -h show help
|
||
--version, -v print the version
|
||
```
|
||
|
||
### Examples
|
||
|
||
Upload file to an rclone remote when it has been inactive for at least 30s,
|
||
keeps the directory structure
|
||
```bash
|
||
./beemer -w 30s -d ./test -c "rclone move %file remote:/beem/%dir"
|
||
```
|
||
|
||
Send file via SSH, ignoring the local directory structure
|
||
```bash
|
||
./beemer -d ./test -c "scp %file worker@StagingServer:flatdir/"
|
||
```
|
||
|
||
Upload file to transfer.sh, store URLs in `urls.txt`
|
||
```bash
|
||
./beemer -w 1s -d ./test -c "bash -c \"curl -s -w '\\n' --upload-file %file https://transfer.sh/%name &>> urls.txt\""
|
||
```
|
||
|
||
### Beem command template
|
||
|
||
| Special sequence | Description | Example |
|
||
| :--- | :--- | :--- |
|
||
| `%file` | Full path of the modified file | `/tmp/beemer/test/a/myFile.txt` |
|
||
| `%name` | Name of the modified file | `myFile.txt` |
|
||
| `%dir` | Directory of the modified file, relative to the watched dir. | `test/a` |
|