bash 및 grep을 사용하여 libnotify

bash 및 grep을 사용하여 libnotify

로그 파일을 추적하는 동안 특정 문자가 발견되면 알림을 표시하도록 libnotify(notify-send)를 얻으려고 합니다.

grep 없이는 잘 작동합니다 ...

이것은 내 코드입니다.

 tail -f /var/log/mylogfile | grep ">" | while read line; do notify-send "CURRENT LOGIN" "$line" -t 3000; done

grep을 포함하면 보낸 알림이 전달되지 않습니다. 위의 코드를 다음에서 수정했습니다.https://ubuntuforums.org/showthread.php?t=1411620

그리고 글꼴 크기는 어떻게 변경하나요?

답변1

이 페이지grep 및 출력 버퍼링을 설명하려면 어쨌든 다음 플래그를 사용하고 싶습니다 --line-buffered.

tail -f /var/log/mylogfile | grep --line-buffered ">" | while read line; do notify-send "CURRENT LOGIN" "$line" -t 3000; done

글꼴에 관해서는,이 AskUbuntu 질문이는 공식적으로는 가능하지 않다고 언급되어 있으나 notifyosdconfig일부 ​​수정이 가능한 툴이 설명되어 있습니다.

관련 정보