LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   schedule and terminate activity (https://www.linuxquestions.org/questions/linux-general-1/schedule-and-terminate-activity-4175681715/)

timl 09-07-2020 08:03 PM

schedule and terminate activity
 
Hi,

I would like to listen to a radio stream broadcast from the UK. The problem is that this a simple stream. There is no catch up facility. You have to listen from the stream as it is broadcast.

I am interested in a show broadcast 5am-7am my time. This straddles my wake up and “go to work” times. I am looking for suggestions on how to grab the stream at 5am and terminate 2 hours later or at 7am.

My first thought was to set off a cron job for 5am – wget the stream. Not sure how I would tell this to stop though as the stream is continuous.

Any ideas?

Cheers

HappyTux 09-07-2020 08:30 PM

Quote:

Originally Posted by timl (Post 6163622)
Hi,

I would like to listen to a radio stream broadcast from the UK. The problem is that this a simple stream. There is no catch up facility. You have to listen from the stream as it is broadcast.

I am interested in a show broadcast 5am-7am my time. This straddles my wake up and “go to work” times. I am looking for suggestions on how to grab the stream at 5am and terminate 2 hours later or at 7am.

My first thought was to set off a cron job for 5am – wget the stream. Not sure how I would tell this to stop though as the stream is continuous.

Any ideas?

Cheers

Make a script to start the wget download to a file then put a sleep statement in it. Once the time has expired the script will exit and you should have your stream.

Edit: You may need a kill wget or something similar to stop it once the time has expired, now I think more on it.

Turbocapitalist 09-08-2020 01:29 AM

Another option is to use cron or at to launch your downloader.

If you need either to launch a graphical program, then use the DISPLAY environment variable.

Then use another job for pkill.

Or precede it all with timeout and a time limit when the script is launched.

timl 09-08-2020 02:33 AM

Quote:

Originally Posted by Turbocapitalist (Post 6163674)

Or precede it all with timeout and a time limit when the script is launched.

Thanks turbocapitalist.
Quote:

timeout 120m wget http://server.aradio.net:8100/stream -O /home/tim/test$(date +%Y%m%d).mp3
Is exactly what I was looking for. I ran a couple of tests and it looks good so I have set up the cron job for tomorrow morning.

I'll report back then.

The joys of linux and learning :)

timl 09-09-2020 05:15 AM

Yup, all good. Show received and being listened to now.

Thanks


All times are GMT -5. The time now is 06:21 PM.