All pastes #613996 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-07-11 08:45 UTC
rendered paste body
#!/usr/bin/env bash

if [ $# != 2 ] ; then
  echo "usage: $0 <timeout> <message to look for>"
  exit 1
fi

tail -f /var/log/messages | grep --line-buffered $2 >/tmp/foo &

sleep $1
kill %1
if grep $2 /tmp/foo >/dev/null ; then
  echo "found it"
  exit 0
else
  echo "didn't find it"
  exit 1
fi