Trying to run a script with crontab

I'm trying to run a script with crontab every 5 min.
But there is no result. When I cat the log file, I get the following:

Cannot autolaunch D-Bus without X11 $DISPLAY

Am I missing or should install something. Read online that the following
DISPLAY=:0 dconf reset -f /org/compiz/
Could resolve the issue. I tried it in the terminal and copied to the script but it doesn't work.

The line I created with crontab -e is as follows:
*/5 * * * * ~/Scripts/myscript.sh > /tmp/my.logfile 2>&1

Unless you installed and configured Compiz, then that setting will not help.

sudo apt-get install pass gnupg2

Generate your gnupgp key

gpg2 --gen-key

pass init $gpg_id

Thank you Aravisian,
Should I install compiz first and then run the commands you suggest?
BTW it says compiz-core.

What says compiz-core?

The above deals with having the authority to enact certain sensitive commands, and is unrelated to Compiz.
You appear to be trying to run a script that requires gnupg access. If I have gotten the wrong end of the stick, please let me know.

None of that should require or have anything to do with Compiz.

However, it may be that the task you are trying to run requires Compiz. I do not know. Only you know that, currently. :wink:
I am not in the habit of asking people to relay what the exact script is or what it is for...

I have to say but its not authority related.

I've installed compiz-core, but don't know much about setting it. I hoped someone with the crontab, X11 display settings or compiz would know more, concerning the feedback from the logfile.

Reading the net I find only crontab rules with scripts having to do mostly with backing up. I personally do backing up manually.
The script I'm running does effect the display.

Yes, and if you are backing up anything in root...

Nope, I'm not backing up or doing something to root, except effecting the display that is. Do you think the error concerning D-Bus, X11 or Display is authority related?
But not password, because the output/error would then be of a diff. kind.

I still do, yes, because Xorg is in root, as well.
I think compiz is chasing an untamed ornithoid without cause.
Without really knowing what you are scripting or calling on...:

This does not mean that the suggestion I made earlier applies, though. What I mean is that examining the Authority is the best first thing to check.

1 Like

What does your script do? Can you post the contents?

I didn't think you can run GUI apps from cron? I thought it ran in a non-interactuve shell, like systemd.

2 Likes

Aravisian, thanks for the link. I removed compiz and did not install the line which you suggested but copied a line, concerning the display and added it to the crontab line. The error dissapeared, but my script did not run. So the problem is of a different kind, which I will try to figure out later. It's not a major problem.

Hello jgordon, thanks for the response.
Strange enough crontab does run GUI apps. Just figured ti out, because changing the job line within crontab like;

*/5 * * * * gnome-control center > /tmp/my.logfile 2>&1

Does do the "job".

2 Likes

This implies that there is something wrong with the script itself.

1 Like

True, the script doesn't run in combination with the job line. But I tested it in the terminal and the script is ok.

I just have to look further how to make it all work. But thanks for the link, my script does effect the Display so the link was useful and did solve the error. I will try to look further how to solve this, thanks you.

I wouldn't call this solved, just yet.

Yep, wouldn't call it "totally" solved because crontab is not the issue. But the job runs fine and your link provided the solution to the display error. and that was the reason I made this topic. Thank you again.

To have it run as I wish will be trail and error and rewriting the script.

i do remember a server we had a work required a GUI to work running Adobe Framemaker apps, a long time ago. I vaguely remember having to be logged in on the console to point $DISPLAY at it to run.

Does the job run in cron if you are logged in?

1 Like

yes, the job runs in cron without any further problem. The file in /tmp does not cat an error of any kind, which means that the script is running.
Its just the final result which I will have to tweak and test.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.