diff options
Diffstat (limited to 'bash/logtail')
-rwxr-xr-x | bash/logtail | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bash/logtail b/bash/logtail new file mode 100755 index 0000000..361d121 --- /dev/null +++ b/bash/logtail @@ -0,0 +1,10 @@ +#!/bin/bash +( + echo -n "$1"/ + ls -tc "$1" | head -n 1 + inotifywait -q -m --exclude=xz -e CREATE --format %f "$1" +) | while read line; do + trap "jobs -rp | xargs --no-run-if-empty kill" EXIT; + jobs -rp | xargs --no-run-if-empty kill; + tail -F "$line" & +done |