I have a script that works out the version number of todays Guardian crossword and makes the url address that I want to print from (I can wget a pdf and print that, but I (well my wife) prefers the layout of the 'Print' version from the guardian site & I liked the challenge ...) this is all done in Crontab so that when I go down to make coffee in the morning the xword is sitting on the printer.
The Script works fine but the Chromium-browser line generates some error/warning lines that means that it 'breaks' out of Crontab
The instruction for todays cryptic is
chromium-browser --headless --disable-gpu --print-to-pdf https://www.theguardian.com/crosswords/cryptic/27874/print
This generates the following warnings/errors
[0717/095632.416036:ERROR:browser_main_loop.cc(595)] Failed to put Xlib into threaded mode.
Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
[0717/095656.880928:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0717/095656.882987:WARNING:property.cc(149)] DaemonVersion: GetAndBlock: failed.
[0717/095656.888510:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0717/095656.896507:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0717/095723.699733:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0717/095723.700790:WARNING:property.cc(149)] DaemonVersion: GetAndBlock: failed.
[0717/095723.704371:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0717/095723.711608:ERROR:object_proxy.cc(621)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0717/095728.944780:INFO:headless_shell.cc(534)] Written to file output.pdf.
Which is 'fine', because it gets to the last line
[0717/095728.944780:INFO:headless_shell.cc(534)] Written to file output.pdf.
so my script can continue to
lp -d HP_ENVY_4520_series output.pdf
rm output.pdf
However when I have the script as a task in crontab, it executes all the string manipulation stuff from 'scrubbing' the dated url for the version number to get the url for the print version but then 'escapes' out of the script due to the error messages above rather than just chugging away ... as the script initiated at the CLI does ...
Is there away that I can suppress these errors like a --q? so that the cron job just ignores them? I have tried to redirect the output at the end of the chromium-browser line
>/dev/null 2>&1
in the hope that it would help but whilst quieting the outputs it doesn't ...
I know that errors should be fixed rather than worked around, but I just need this to run uninterrupted in Crontab as it does from the CLI, any ideas?
Thanks in anticipation
Pete
A suggestion to go to the source and recompile is out of my comfort zone ...
chromium-browser --headless --disable-gpu --print-to-pdf https://www.theguardian.com/crosswords/cryptic/27874/print
if you try it out it will generate the required file output.pdf, it just won't run in crontab - I THINK? because of the errors? but nobody has confirmed that this is the case with cron ... I'm frankly stuck ... I can just run it every morning, but that's not the point I might as well just go to the web site, I'm so close ... & yet ... so far ...