Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/james7132/ttl-file-rs
Zero-config management of expiring files.
https://github.com/james7132/ttl-file-rs
Last synced: 27 days ago
JSON representation
Zero-config management of expiring files.
- Host: GitHub
- URL: https://github.com/james7132/ttl-file-rs
- Owner: james7132
- License: apache-2.0
- Created: 2022-10-24T02:58:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-18T22:55:27.000Z (about 2 months ago)
- Last Synced: 2024-11-18T23:34:08.419Z (about 2 months ago)
- Language: Rust
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# ttl-file-rs
This is a simple daemon that monitors directories and deletes files
that have exceeded a configured
[time-to-live](https://en.wikipedia.org/wiki/Time_to_live).## Usage
```bash
ttl-file
```The daemon will watch all provided directories recursively and delete files based
on a per-directory TTL. If no directories are provided, the current working
directory will be used instead.TTL is configured by including directories in the filepath named with the pattern
`ttl=`. The TTL is based on the creation timestamp, not the last
modified timestamp. For example, `/home/user/directory/ttl=30d/documents/test.pdf`
will be deleted 30 days after the file is first created. TTLs are enforced down
to the precision of one second.If multiple `ttl=X` directories are found on the filepath, the lowest-level
directory's configuration will be used For example,
`/home/user/directory/ttl=30d/documents/ttl=30m/test.pdf` will use a 30 minute
TTL instead of the upper level 30 day config.Only files will be deleted. Directories will not be touched.
Filesystems with hard-linked loops will likely cause the daemon to infinitely
loop. This should generally not be possible with most modern Unix-based systems.## Docker Container
You can use the daemon as a Docker container. An example docker-compose.yml file:```yaml
version: "3.9"
services:
ttl:
image: ghcr.io/james7132/ttl-file-rs:latest
volume:
# By default everything under /ttl is watched by the daemon
- /your/host/directory/here/1:/ttl/ttl=30d/container/directory
- /your/host/directory/here/2:/ttl/ttl=10m/container/directory
```## License
MIT or Apache 2.0