LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-20-2010, 09:40 AM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Reminder using cron


I wonder if it's possible to have cron run xmessage or gxmessage at certain intervals?

I tried this:

Code:
40 9 * * * /usr/bin/xmessage test
but it didn't work.
 
Old 04-20-2010, 10:22 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,941

Rep: Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671
Quote:
Originally Posted by MTK358 View Post
I wonder if it's possible to have cron run xmessage or gxmessage at certain intervals?

I tried this:

Code:
40 9 * * * /usr/bin/xmessage test
but it didn't work.
Ok....WHAT didn't work? What did it do? What error(s) did you get? Anything in the cron log? Did both xmessage and gxmessage give you the same results?

You could also try to put the xmessage command/message into a script file, and call that via cront. I've seen cron not take things before when you're passing an argument, etc., but shoving it into a shell script, and calling IT seems to work.
 
Old 04-20-2010, 10:26 AM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Original Poster
Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Quote:
Originally Posted by TB0ne View Post
Ok....WHAT didn't work?
Nothing happened.

Quote:
Originally Posted by TB0ne View Post
What did it do?
Nothing.

Quote:
Originally Posted by TB0ne View Post
What error(s) did you get?
None that I know of.

Quote:
Originally Posted by TB0ne View Post
Anything in the cron log?
I don't know where that is.

Quote:
Originally Posted by TB0ne View Post
Did both xmessage and gxmessage give you the same results?
Yes.

Quote:
Originally Posted by TB0ne View Post
You could also try to put the xmessage command/message into a script file, and call that via cront. I've seen cron not take things before when you're passing an argument, etc., but shoving it into a shell script, and calling IT seems to work.
I don't know.

I tested it by replacing xmessage with "/usr/bin/wall test" and that worked.
 
Old 04-20-2010, 01:57 PM   #4
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,941

Rep: Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671
Quote:
Originally Posted by MTK358 View Post
I don't know where that is.
Cron logs are usually in /var/spool/cron, or something similar. Usually cron.log. Any job status (success or failure) are noted.
Quote:
I don't know.
I tested it by replacing xmessage with "/usr/bin/wall test" and that worked.
Different commands work differently. Try the xmessage in a small shell script, and see what it does.
 
Old 04-20-2010, 02:14 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Original Poster
Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Quote:
Originally Posted by TB0ne View Post
Different commands work differently. Try the xmessage in a small shell script, and see what it does.
It didn't work.
 
Old 04-20-2010, 02:26 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 12,045

Rep: Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757Reputation: 757
xmessage is a windows app and since cron is not connected to an x server it fails to work where as wall just sends messages to a terminal. Something like the follow should work but I have not personally tested it..

00 08 * * * /usr/bin/X11/xmessage -display :0.0 message goes here.
00 08 * * * DISPLAY=:0.0 /usr/X11R6/bin/xmessage message goes here.
 
1 members found this post helpful.
Old 04-20-2010, 02:35 PM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Original Poster
Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
It works:

Code:
* * * * * /usr/bin/xmessage -display :0.0 'this is a message'
 
Old 04-20-2010, 02:36 PM   #8
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,941

Rep: Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671Reputation: 2671
Quote:
Originally Posted by michaelk View Post
xmessage is a windows app and since cron is not connected to an x server it fails to work where as wall just sends messages to a terminal. Something like the follow should work but I have not personally tested it..

00 08 * * * /usr/bin/X11/xmessage -display :0.0 message goes here.
00 08 * * * DISPLAY=:0.0 /usr/X11R6/bin/xmessage message goes here.
VERY good catch...didn't occur to me. Well done.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 09:57 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U Suse/Novell 11 01-04-2007 02:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM
quick cron reminder needed jedimastermopar Linux - General 1 05-26-2005 05:09 PM


All times are GMT -5. The time now is 10:24 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration