get_iplayer at i.lucanops.net get_iplayer at i.lucanops.net
Fri Mar 8 05:51:27 PST 2019

Hey Mike,

On Fri, 08 Mar 2019 13:19:10 +0000
iplayer at nutwood.net wrote:
> Nothing wrong with this, but I had expected the full output, as would
> be seen if running the pvr manually. I don't necessarily want all
> that but I need to be sure that download failures are logged and
> also, if possible, problems such as multiple retries which may
> indicate trouble elsewhere. Can I be sure that errors would be logged?

There are two text outputs, which can look the same in a terminal. One
is stdout the other stderr. You can combine the two into the one log:

gip --etc >> log_file 2>&1

Or have two files

gip --etc >> log_file 2>> error_file

It is probably best to have the one file so related messages are all
together. OTOH, if you really care only about errors then separate
files might be better. Or even only logging stderr.

> Also, I'm confused by the writing of the log file. Sometimes it
> appears that new entries have been appended to the existing file, at
> others that the file has been overwritten. I'm not yet 100% sure of
> this, though. What I would like to have happen is for a new log file
> to be created for each pvr run, with a filename including the date
> and time. Suggestions for achieving this will be welcome, but please
> remember that I am new to Linux!

gip --etc >> $(date +%F)_log_file

The $(command --options) bit is a sub-shell. The output, today, of date
+%F is "2019-03-08", and that string would replace $(date +%F) in the
log filename.

Sub-shells can also be done with the back-quote character, `date +%F`
is basically the same. I think the $(command) syntax is just more
compatible across shells, so is best to use.

Now I think about it I don't think you can put sub-shells in a
cron-tab. You would need to make a little script to launch gip, with
its options and piped output, and launch that script via cron.

Personally I have a bin folder in my home, and have a my little hacks
in there. Keeps them vaguely organised.


More information about the get_iplayer mailing list