summaryrefslogtreecommitdiff
path: root/bash/logtail
blob: 361d1218ddcdb7c9956b7f0918ee1cb5e5226d2f (plain)
1
2
3
4
5
6
7
8
9
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