Open a terminal from a Crontab
10,548
Solution 1
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.
Solution 2
* * * * * 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.
Author by
userend
Updated on September 18, 2022Comments
-
userend over 1 year
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.
-
Admin over 12 yearsHaven't used X in awhile but you probably need
DISPLAY
set in your environment. -
hafichuk over 12 yearsWhy are you trying to do this?
-
userend over 12 yearsI want to send myself a message at a certain time. I will find another way.
-
-
Ignacio Vazquez-Abrams over 12 yearsThere's also no guarantees that the user crond runs as will have the X auth cookie.
-
userend over 12 yearsThis 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 over 12 yearsThis 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 over 12 yearsThanks for your help I will try Python-notify to accomplish this task.
-
Scott - Слава Україні about 5 yearsWhat is
/home/user/show-my-script-in-window-terminal.sh
?