Play sound alert on any activity in Putty window

2

I've a putty connection open on my windows box and I'd like Putty to notiy me on any activity in the terminal (I'm running tail -f on a log file). How do I achieve that? Putty isn't necessary in that equation, I just want the sound.

Ideally, I'd like the sound to repeat until I disable it manually. This way I won't miss it, when I'm watching Simpsons in the other room.

user384531

Posted 2014-10-28T15:01:36.413

Reputation: 23

You could run screen inside putty and turn on monitoring and audio alerts? I don't think putty has the "smarts" to do this on its own: you'll need to have an application generate the ^G and then putty will beep you. – barrycarter – 2014-10-28T17:46:25.130

Answers

1

The only sound-making ability which putty has is to play a sound when Ctrl-G (the ASCII BEL character) is received. You can change what it does in response to Ctrl-G from Configuration->Terminal->Bell.

After setting putty to make a bell sound, you could run "tail" like this to send a BEL character to your terminal every time "tail" prints a line:

tail -f /some/file | awk '{print "\07" $0}'

A problem with this approach is that you'll probably see buffering between "tail" and "awk". You won't see output appear line-by-line; instead it will only appear every time a couple of kilobytes of data builds up. This probably not acceptable if the intent is to be alerted every time a message is logged.

A reasonably skilled developer could write a replacement for the "tail" command which adds BEL characters to the output. For example, there's a Perl module for tailing a file, with sample code that illustrates behavior like tail -f. It'd be very simple to add BEL characters to that script.

Kenster

Posted 2014-10-28T15:01:36.413

Reputation: 5 474