View Single Post
  #10  
Old 14.09.2010, 09:46
drbits's Avatar
drbits drbits is offline
JD English Support (inactive)
 
Join Date: Sep 2009
Location: Physically in Los Angeles, CA, USA
Posts: 4,434
Default

The PS command (with the appropriate parameters) allows you to list information about all of the processes (and I think threads). If you grep the output of ps -e (I think) grep will return a different value when it finds an occurrence than when it does not.

It has been years since I did this, so this is probably not right (the parameters changed) You are looking for a script something like:

Code:
while (`ps -e | grep "java.*"') {
    if (`ps -e --windowtitle | grep "*.?\Please Enter"') beep 700 2
    sleep 2
    }
sleep sleeps up to that number of seconds. It is like cron in that it uses the end of a second to update, rather than the passage of time. So `sleep 2` should sleep 1 to 2 seconds.

If the beep parameters are as I remember them, this is a request for a 2 second beep at 700Hz (A above middle C). That is the same frequency as most beeping alarm clocks. Almost nobody can sleep through it. We used to play songs by using beep followed by pairs of numbers.

Note that the conditionals are enclosed in accent characters ` ` so that they will be interpreted each time. This would be more efficient in TEMACS or AWK, but a lot harder to write.

As to regular expressions, they have changed a little over the years. Look at the documentation in the JDownloader Wiki.

I have been locked in the Windows world almost full time since 1996. Every so often, I get a chance to work in *nix for things like build scripts.

Last edited by drbits; 14.09.2010 at 09:49.
Reply With Quote