Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I get a gnome-terminal window to open from a crontab?

I have tried this:

    * * * * * /usr/bin/gnome-terminal 

    * * * * * source /home/user_name/.bashrc ; /usr/bin/gnome-terminal

    * * * * * source /home/user_name/.profile ; /usr/bin/gnome-terminal

    * * * * * source /home/user_name/.bashrc ; /home/user_name/bin/opengnometerminal.sh

None of these seem to work.

share|improve this question

migrated from stackoverflow.com Oct 28 '11 at 10:52

This question came from our site for professional and enthusiast programmers.

    
Haven't used X in awhile but you probably need DISPLAY set in your environment. – mu is too short Oct 28 '11 at 3:25
    
You could use cron to touch a file somewhere and use an inotify script (which is running in your X session) to watch the file and launch a terminal when the file changes... – Mel Boyce Oct 28 '11 at 3:26
    
Why are you trying to do this? – hafichuk Oct 28 '11 at 3:30
    
I want to send myself a message at a certain time. I will find another way. – userend Oct 29 '11 at 22:50
up vote 3 down vote accepted

You can't, safely. cron jobs run independent of the desktop session where X is running, therefore you can't do this without causing security violations.

share|improve this answer
    
Thanks for your help I will try Python-notify to accomplish this task. – userend Oct 29 '11 at 22:49
* * * * * export DISPLAY=:0 && /usr/bin/gnome-terminal

Though this is not really a robust solution since there's no guarantees that X server will be on :0.

share|improve this answer
3  
There's also no guarantees that the user crond runs as will have the X auth cookie. – Ignacio Vazquez-Abrams Oct 28 '11 at 3:42
    
This is what I got when I tried that on my system: <code> Failed to parse arguments: Cannot open display: </code> I think I will try Python-notify. – userend Oct 29 '11 at 22:44
    
This is what I got when I tried that on my system: [code] Failed to parse arguments: Cannot open display: [/code] I think I will try Python-notify. – userend Oct 29 '11 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .