Cron Job Failed

29 views
Skip to first unread message

Paul Boniol

unread,
Dec 11, 2020, 3:03:44 AM12/11/20
to NLUG
I've been using Linux for largely desktop use for a long time, but have not gotten too into automation.  I've finally gotten back around to trying to schedule cron to run vlc, to record a radio stream nightly at midnight (local).  I got a command I think is good, and it appears cron is kicking it off.  But it isn't producing the expected output file.

crontab -e as my usual user.

0 0 * * * timeout 4h cvlc -I dummy https://stream.revma.ihrhls.com/zc2149/hls.m3u8 :no-video :sout="#transcode{acodec=mp3,ab=128}:std{access=file,mux=dummy,dst=/home/paul/Audio/Coast-$(date '+%Y-%m-%d-%H-%M-%S').mp3"

In /var/log/syslog.1 I see it kicked off. "No MTA installed, discarding output".  (Fine for normal use, but the command seems to have failed.)  Then nothing.

Any suggestion on next debugging steps, or know what I'm doing wrong?

Paul

John R. Dennison

unread,
Dec 11, 2020, 3:16:36 AM12/11/20
to nlug...@googlegroups.com
On Fri, Dec 11, 2020 at 02:03:25AM -0600, Paul Boniol wrote:

>
> crontab -e as my usual user.
>
> 0 0 * * * timeout 4h cvlc -I dummy
> https://stream.revma.ihrhls.com/zc2149/hls.m3u8 :no-video
> :sout="#transcode{acodec=mp3,ab=128}:std{access=file,mux=dummy,dst=/home/paul/Audio/Coast-$(date
> '+%Y-%m-%d-%H-%M-%S').mp3"

Any '%' in a crontab needs to be escaped as it has special meaning to
cron:

"A "%" character in the command, unless escaped with a backslash (\),
will be changed into newline characters, and all data after the first %
will be sent to the command as standard input."

(man 5 crontab)

--
Live every day like it's your last because someday you're going to be right.

-- Muhammad Ali
signature.asc

Brian H. Ward

unread,
Dec 11, 2020, 10:08:40 AM12/11/20
to nlug...@googlegroups.com
Also, the "No MTA installed, discarding output" is the result of not having a Mail Transport Agent installed/configured. Cron traditionally sends you email with the full blown output from jobs (failed or otherwise). That email is your preferred debugging technique. The email will be sent to the user who owns the crontab. The email system you install can be setup to only support mail on the localhost (no real support for sending/receiving internet email). Hope that (also) helps.

--- bhw

--
--
You received this message because you are subscribed to the Google Groups "NLUG" group.
To post to this group, send email to nlug...@googlegroups.com
To unsubscribe from this group, send email to nlug-talk+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en

---
You received this message because you are subscribed to the Google Groups "NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nlug-talk+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nlug-talk/20201211081614.GF5777%40elros.gerdesas.com.


--
"Humanity will not be free until the last stone of the last church falls on the head of last priest" -- The Emperor of Mankind, Warhammer 40,000

Michael Chaney

unread,
Dec 11, 2020, 11:39:45 AM12/11/20
to nlug...@googlegroups.com
To build on what the other two are saying:

crontabs have special formats and ultimately they're going to munge certain characters as will the shell.  Putting a command like that in crontab will always be an exercise in frustration and often leads to the "four backslashes" issue.

I'd recommend you move the command to a shell script and then run the shell script from crontab.  You might even leave the timeout command in the crontab.  But I'd definitely put the rest of it into a shell script.

--

Paul Boniol

unread,
Dec 11, 2020, 12:13:41 PM12/11/20
to NLUG
Thank you! Knew it was probably something simple I was overlooking.  That got it working.

Paul

Csaba Toth

unread,
Dec 11, 2020, 12:39:56 PM12/11/20
to nlug...@googlegroups.com
On top of the suggestions:
1. I think you may have an MTA but may not configured mail for the root.
2. To actually see what the script does: I'd wget that m3u url and see what comes out of the wire. If it's a legit playlist than I'd wget some of that as well if legit.
3. Check that the transcoder works at the command line

Paul Boniol

unread,
Dec 11, 2020, 3:24:51 PM12/11/20
to NLUG
I'll check on the MTA. It is an old Mythbuntu install. (Ever so slowly moving to a new box.)

The URL is Nashville 1510 AM through iHeart Radio, found by digging through the HTML. Been working for months when I "tune in" to  Coast to Coast AM on occasion at night. A more advanced version would read the HTML and pull the URL at run time, in case it changes. Haven't gotten to, or needed, that yet.

Trying from the command line was new but verified I finally got working parameters Wednesday.

Escaping the %'s in Cron got it working through cron, for now.

Paul

Paul Boniol

unread,
Dec 11, 2020, 10:58:15 PM12/11/20
to NLUG
Thanks for the push to continue.  Easier to test changes. Here's the latest.  And verified cron can start it.

!/bin/bash
stream="https://stream.revma.ihrhls.com/zc2149/hls.m3u8"
acodec="mp3"
arate="128"
mux="raw"
outfile="/home/paul/Audio/Coast-$(date '+%Y-%m-%d-%H-%M-%S').mp3"

timeout 4h vlc -I dummy $stream --no-video --sout="#transcode{acodec=$acodec,ab=$arate,channels=2,samplerate=44100}:std{access=file,mux=$mux,dst=$outfile}"

--
--
You received this message because you are subscribed to the Google Groups "NLUG" group.
To post to this group, send email to nlug...@googlegroups.com
To unsubscribe from this group, send email to nlug-talk+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en

---
You received this message because you are subscribed to the Google Groups "NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nlug-talk+...@googlegroups.com.

Curt Lundgren

unread,
Dec 11, 2020, 11:06:56 PM12/11/20
to NLUG
Thanks Paul - I wrote a small Perl script to start a recording as you're doing.  I'm using ab=24, samplerate="22050", channels=1 - which produces a very listenable recording using much less space on disk.

Also, I will confess I'd never seen the timeout command before - that's a very useful tool.

Thanks again for starting this discussion.

--
--
You received this message because you are subscribed to the Google Groups "NLUG" group.
To post to this group, send email to nlug...@googlegroups.com
To unsubscribe from this group, send email to nlug-talk+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en

---
You received this message because you are subscribed to the Google Groups "NLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nlug-talk+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages