So the other day I installed Ubuntu 14.04 LTS at home in a partition next to Windows 7. As I'm not able to be at home to watch the Sailplane Grand Prix live as streamed on YouTube, I decided to use livestreamer (http://livestreamer.readthedocs.org/en/latest/) to save it to a file using its -o option.
This works fine (I think - test is running today and I'll see what it looks like when I get home tonight) except that I have to start the command before leaving home in the morning, and the broadcast only starts around mid day, leading to some wasted bandwidth in the morning.
So the obvious thing is to use cron to schedule it, right? Only, when running it from cron it never creates the output file. The cron line I use is this:
38 23 13 05 * ./getfaisgpstream 2> /home/me/getfaisgpstream.log
Like I say, the time comes and goes, and the file /home/me/faisgp20140513 does not appear like it does when running livestreamer from the terminal. I know about the issue where crontab lines need to end in a newline, and I purposefully left a blank line at the bottom of the file to cater for that.
I used crontab -e to change the cron file.
The output I get in "getfaisgpstream.log" is:
./getfaisgpstream: 6: ./getfaisgpstream: livestreamer: not found
The contents of the file "./getfaisgpstream" is:
echo
echo ======= livestreamer script running to get FAI SGP 2014 stream and save it in home: [`date`]
echo
while true; do
livestreamer --hds-timeout 300 --hls-timeout 300 --rtmp-timeout 300 --http-timeout 300 --http-stream-timeout 300 -fo /home/me/Videos/faisgp`date +%Y%m%d` http://www.youtube.com/watch?v=xmy5VHAvNMg best
echo ======= livestreamer terminated, restarting [`date`]
echo; done
echo
echo ======= livestreamer script exiting [`date`]
echo
And yes this makes it too robust - but whatever, I'm after a simple hack right now that will solve this for recording the broadcast tomorrow.
2> /home/me/logfile.txt
and check whether any output is printed to that file. Also, try quoting the URL:livestreamer -o /home/me/faisgp20140513 'https://www.youtube.com/watch?v=xmy5VHAvNMg' best