Skip to content

Commit

Permalink
- implement post kill cleanup based on plotid wildcard search
Browse files Browse the repository at this point in the history
  through dst/tmp/tmp2 dirs (#582,...)
  • Loading branch information
mk01 committed Jul 4, 2021
1 parent f8e7880 commit 82e22b6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/plotman/resources/hooks.d/99-post-kill-cleanup.sh.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

. ${PLOTMAN_HOOKS}/.lib.include

[ "${PLOTMAN_TRIGGER}" = "KILL" ] || exit 0

logInfo "${PLOTMAN_TRIGGER} triggered processing plot id ${PLOTMAN_PLOTID} (ph: ${PLOTMAN_PHASE})"

for d in "${PLOTMAN_DSTDIR}" "${PLOTMAN_TMPDIR}" "${PLOTMAN_TMP2DIR}"; do

### avoid using find, grep, xargs - all those can be various implementations
### behaving differently for corner cases like spaces in file name, or can
### implement different set of arguments (POSIX vs BSD variants, busybox, ....)
### so do it the legacy way
ls "${d}/"*${PLOTMAN_PLOTID}* | while read f; do
rm -v "$f"
done
done

0 comments on commit 82e22b6

Please sign in to comment.