Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 2 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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