Question

I want to create a simple reminder on linux at a certain time everyday. I am using crontab to schedule running the reminder script, while in the script I am using zenity to display a simple dialog box with a question.

In more details, I have the following script reminder.sh:

#!/bin/bash
zenity --question --text="question?"

Then, using crontab -e, I add the following task to run every single minute (just for testing):

* * * * * /path/to/reminder.sh

But the dialog box doesn't appear. I added some other commands to the script and I confirmed that the script runs every minute, but the dialog box still doesn't appear!

Any hints?

Was it helpful?

Solution

I did find the solution. When I did echo of the $DISPLAY in the same script, it has nothing in it. So, I've set it to my machine display. But this didn't work till I added xhost + to the script.

The final script would look like:

#!/bin/bash
xhost +
/user/bin/zenity --question --text="question?" --display="myMachine:0.0"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top