head specification states: “The application shall ensure that the number option-argument is a positive decimal integer”
Negative values are supported on GNU
head, so this works in the discourse docker image. However, in some environments (e.g. macOS), the system
head version fails with a negative n parameter.
This commit does two things
pipefailto the cleanup command, so it cannot fail silently
- Flip the
lscommand to list in descending time order, and use
tail -n +501instead of
head -n -500.