Thursday, September 28, 2023
rated 0 times [  12] [ 0]  / answers: 1 / hits: 15502  / 1 Year ago, sun, august 21, 2022, 2:42:36

Updates START

  1. A friend of mine just answered this. I need to do this export DISPLAY=:0 && <my GUI dependent command here> Waiting for him to post the answer here.

  2. I have tried /opt/google/chrome/chrome PARTICULAR_GOOGLE_DOC_URL & without the & too. Still fails. Succeeds directly on command line.

  3. There is no /var/log/cron file on my machine. Subsidiary question: How can I get it?

Updates END

I have a Google Doc that I need to update at regular intervals multiple times a day. The content that would form a particular update cannot be predicted or determined programatically. So, the best solution I have is to have the particular Google Doc page open up automatically at fixed intervals and then I manually add the data to it.

Now, the problem is that what works directly on the command line does not work when used in crontab. Below is what I have tried (using 2mins interval just for testing) -

*/2 * * * * date >> /tmp/crontest
*/2 * * * * /opt/google/chrome/chrome PARTICULAR_GOOGLE_DOC_URL &

  1. If I cat /tmp/crontest , I see timestamps added there for every 2nd minute

  2. If I just try /opt/google/chrome/chrome PARTICULAR_GOOGLE_DOC_URL on the shell, it works as expected

  3. But PARTICULAR_GOOGLE_DOC_URL does not get opened in my chrome every 2nd min as it should. (again: I am using 2mins interval just for testing)

What am I doing wrong? How should I fix this? Any alternate way of achieving what I need done?

Thanks in advance.

More From » command-line


Edit the crontab with export DISPLAY wrapper:

2 * * * * export DISPLAY=:0 && firefox %u

This opens an empty Firefox tab, you can use you favourite URL.

[#33267] Tuesday, August 23, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 421
Total Questions: 92
Total Answers: 109

Location: Uzbekistan
Member since Mon, Jul 20, 2020
3 Years ago