LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 01-02-2004, 12:17 PM   #1
vincebs
Member
 
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 494

Rep: Reputation: 30
Question 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?
 
Old 01-02-2004, 12:51 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
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.
 
Old 01-06-2004, 01:34 AM   #3
vincebs
Member
 
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 494

Original Poster
Rep: Reputation: 30
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.
 
Old 01-06-2004, 01:12 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
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 ).
 
Old 01-06-2004, 03:44 PM   #5
vincebs
Member
 
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 494

Original Poster
Rep: Reputation: 30
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?
 
Old 01-06-2004, 05:07 PM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
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.
 
Old 01-07-2004, 01:32 AM   #7
vincebs
Member
 
Registered: Oct 2003
Location: Mississauga, ON
Distribution: Ubuntu 9.04
Posts: 494

Original Poster
Rep: Reputation: 30
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?
 
Old 01-07-2004, 05:10 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Terminal Program for Slack 9.0 ??? TheDanLayerOSI Linux - Software 5 11-30-2003 05:01 PM
How do I tell what version a program is from a terminal? rkid Linux - Software 3 10-14-2003 03:07 AM
Starting program with terminal TazLinux Linux - General 8 02-26-2003 08:16 AM
terminal program metallica1973 Linux - General 4 02-24-2003 12:04 AM
terminal program metallica1973 Linux - Networking 1 02-23-2003 11:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration