2

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 ...

2
  • I dare say if redirection doesn't work then you likely have a typo somewhere. There's no magical way for programs to work around redirected STDOUT/STDERR. Commented Jul 18, 2019 at 8:26
  • Hi @DmitryGrigoryev, thanks for looking at this, there is no typo in the instruction 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 ... Commented Jul 18, 2019 at 14:24

3 Answers 3

1

Welcome, Pete.

Have you tried using a root crontab?

sudo crontab -e
1
  • 1
    Thanks for the Welcome Jonathan, I've lurked here a lot to solve problems, but this is the first time I've got stuck and needed to ask. Yes I am using a root crontab. Commented Jul 17, 2019 at 13:52
0

Delete Chrome cache from home directory.

3
  • Thanks for the Suggestion haykp I deleted the only caches I could find using sudo rm -r ~/.cache/* I Couldn't find a chrome specific cache, there was just a fontconfig one that seemed related so I just deleted everything, didn't help - not sure which file you mean when you say 'home path' - have you got an example CLI line? Pete Commented Jul 17, 2019 at 14:30
  • 1
    Probably not a good idea to just delete all of the system cache in one's home directory. I have edited out the "all files from home path" as this is either a mistake, unclear, or intentionally malicious.
    – goldilocks
    Commented Jul 17, 2019 at 15:28
  • mostly deleting caches helps, sorry to hear that does not help
    – haykp
    Commented Jul 19, 2019 at 5:39
0

I can suggest one more trick, this helped me once with Armbian. Roll back the Chrome to its previous versions.

1
  • I'd like the idea of this, but for the life of me I can't work out how to roll back to say version 65 say ... I'm currently running 72.0.3626.121-0+rpt4 how can I get an earlier version of Chromium-browser? Commented Jul 23, 2019 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.