Click to See Complete Forum and Search --> : Process monitor that sounds an alarm


TheCatMan
03-28-2005, 05:48 AM
Is there any program that will monitor running processes and give an audible alarm, or better still, run a script when a new process starts with a certain name?

Here's the background: I use Skype (www.skype.com) as my only home 'phone, with one soundcard dedicated to 'phone use and another for playing music or whatever. When a 'phone call comes in, it gives me a ringing noise through the same sound card that I use for calls, ie the one with little headphones plugged in. This is a problem because I don't spend my whole life sitting in front of my PC and wearing a headset. Old versions of Skype were able to "ring" on a different soundcard, but that feature has been broken for the last few iterations and the company don't seem interested in fixing it. I've noticed that when a call comes in, Skype starts a new process, with the same name but obviously a new PID.

What I want is something to recognise that (a) a new process has started and (b) this process is named "skype," and respond by making a noise that I can actually hear. Ideally it would also call a script to do things like pausing wget to free bandwidth, popup a message on screen etc. Any other suggestions would also be gratefully received. :)

Thanks in advance.

squeegy
03-28-2005, 12:26 PM
I don't know of any existing solution to your problem. There may be one out there, but I didn't have much luck when googling.

I'm not sure what type of scripting experience you have, but I'm a fan of perl. This Proc:ProcessTable (http://search.cpan.org/~durist/Proc-ProcessTable-0.39/ProcessTable.pm) module along with a little bit of code should be up to the task.

However, I really don't think this is a very good way to go about this. You're better off looking at the root of the problem in Skype itself.

TheCatMan
03-28-2005, 05:25 PM
I agree it's not a good way to go about it. Sadly Skype have so far failed to open up the source, and their development team seems to be having trouble keeping up with the new features they keep adding. On the whole I like their service, so I'm just looking for a quick workaround until they get around to fixing it.

I'm not really much of a scriptor, I came up with this hack earlier which beeps the speaker at appropriate moments:


#!/bin/bash
while
if ps -A|tail -n4|grep skype;
then echo -e "\7";
sleep 0.5;
echo -e "\7";
xmessage -buttons "Call finished" "Call Detected!";
sleep 12;
fi
do sleep 0.2;
done


It does the bare minimum, but I haven't had time to refine it and it's still far from perfect. :p