Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-02-2004, 12:17 PM
|
#1
|
Member
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 496
Rep:
|
How to load program from terminal into X
Hi,
I was wondering how I can get a program to run at the same time every day on my desktop.
What I tried to do was edit my crontab file by adding this line:
40 1 * * * root myprog
The problem is, the program is not loading because it needs X Windows to run.
How do I get a cron job to run an X-based application?
|
|
|
01-02-2004, 12:51 PM
|
#2
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
You can start an xterm and tell xterm to start a program. General syntax:
xterm -e <name program>
A more specific example:
xterm +sb -fg black -bg gray -fn 8x13 -geometry 141x73-0+0 -e /usr/bin/slrn -f .jnewsrc --spool
There is a catch: If your program exits, the xterm will exit as well.
|
|
|
01-06-2004, 01:34 AM
|
#3
|
Member
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 496
Original Poster
Rep:
|
I am getting the error:
/usr/bin/X11R6/xterm.real Xt error: Can't open display:
What I am trying to do is have something like M$'s Task Scheduler program.
|
|
|
01-06-2004, 01:12 PM
|
#4
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Where are you running this xterm.real from?? Looks like you might need to 'export your display', but I never heard of xterm.real so I could be wrong. Did you find anything about this error on the net?
About the task sheduler: I haven't used windows in more then 5 years, so I don't know what program you are refering too. 'sheduler' gives me a good clue ).
|
|
|
01-06-2004, 03:44 PM
|
#5
|
Member
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 496
Original Poster
Rep:
|
I'm trying to run it from the shell on tty1 and causing something to load on the display I'm using now to type this message. Any way I can do this?
An example of what I want to do is have mozilla open my web e-mail account at 11:00pm everyday before I go to bed and forget to check my mail. Any way I could do this?
|
|
|
01-06-2004, 05:07 PM
|
#6
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Are you trying to run a program that needs X from a non GUI environment (runlevel 3, no X running)?? If that is true: You cannot do that. X must be running.
About your 'schedule problem':
You need crontab for the sheduling:
00 11 * * * /full/path/to/program
I don't know the mozilla syntax, but if it's like opera's it looks like this:
mozilla www.somewhere.com/my_web_mail.html
Put both together:
00 11 * * * /full/path/to/mozilla www.somewhere.com/my_web_mail.html
You might need to take care of any error messages that might be send to stderr, if that is the case, change the above example to:
00 11 * * * /full/path/to/mozilla www.somewhere.com/my_web_mail.html 2>/dev/null
Like I said in the first part: X (and a windowmanager) must be running, 'cause mozilla needs it.
|
|
|
01-07-2004, 01:32 AM
|
#7
|
Member
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 496
Original Poster
Rep:
|
I already tried what you suggested. I set a certain X-based task to run at 11pm every day. But at 11pm nothing happens. Yet when I put "init 6" (to restart my computer periodically) in crontab it restarts at 11pm without a fuss.
In Windows, I can enable Task Scheduler to load the program of my choice, GUI-based or not GUI-based, at regular intervals. I need to be able to have something like this in GNU/Linux.
Do I need a Crond For X in order to run an X program?
|
|
|
01-07-2004, 05:10 AM
|
#8
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
I don't think you answered my question about trying to start an X program from a non X environment.
- You cannot start an X program if X is not running (you can if you redirect to a machine that has X running).
- There's no cron for X.
|
|
|
All times are GMT -5. The time now is 10:53 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|