killing and relaunching a task every 15 minutes while a script is running

Hi there,

I would like to write a script which while running will kill and then execute again a task every 15 minutes.

Here's what I want to do:

Al Jazeera English have a low quality, time-limited 15 minute trial stream up at their site. I.e. when I click on the 56K link, it will play in Real player for Linux (which I have installed on Ubuntu 6.10) but after 15 minutes it will stop playing. At that point I can press play again and it wll again play for another 15 minutes. I am trying to write a script that will:

  • curl the .smil file from http://europe.real.com/smil/aljazeera\_us_lo.smil
  • launch realplayer and play that .smil file
  • after 15 minutes, kill realplayer, curl the .smil file again (because due to round robin load distribution I might get on to another server that way, which I want to happen, in order to be a well-behaved user and not to hurt al Jazeera) and then launch realplayer again and play that new .smil file.
  • lather, rinse, repeat

I do not want this to happen all of the time (while my computer is booted up), but rather I only want this to happen on demand, e.g. for as long as a certain script is running.

I have looked at cron, but I could not figure out how to do the above. Cron appears to be designed to do stuff at fixed times while the machine is running.

I would be very grateful for any help or suggestions.

Thanks and regards,
ropers