docs(readme): apply shellcheck suggestions to cleanup script

This commit is contained in:
Orhun Parmaksız 2022-03-17 11:45:05 +03:00
parent 44ab1318ee
commit 2d5c14a6e0
No known key found for this signature in database
GPG key ID: F83424824B3E4B90

View file

@ -100,14 +100,13 @@ $ curl -F "oneshot=@x.txt" "<server_address>"
```
#### Cleaning up expired files
Change `/path/to/rusty` to your rustypaste folder and put this script in the `cron`.
```sh
#!/bin/env sh
now=$(date +%s)
find /path/to/rusty/ -maxdepth 2 -type f -iname "*.[0-9]*" |
while read filename; do
[ "$(( ${filename##*.} / 1000 - ${now} ))" -lt 0 ] && rm ${filename}
find upload/ -maxdepth 2 -type f -iname "*.[0-9]*" |
while read -r filename; do
[ "$(( ${filename##*.} / 1000 - "${now}" ))" -lt 0 ] && rm -v "${filename}"
done
```