LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Reminder using cron (http://www.linuxquestions.org/questions/linux-general-1/reminder-using-cron-803047/)

MTK358 04-20-2010 09:40 AM

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.

TB0ne 04-20-2010 10:22 AM

Quote:

Originally Posted by MTK358 (Post 3941406)
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.

MTK358 04-20-2010 10:26 AM

Quote:

Originally Posted by TB0ne (Post 3941446)
Ok....WHAT didn't work?

Nothing happened.

Quote:

Originally Posted by TB0ne (Post 3941446)
What did it do?

Nothing.

Quote:

Originally Posted by TB0ne (Post 3941446)
What error(s) did you get?

None that I know of.

Quote:

Originally Posted by TB0ne (Post 3941446)
Anything in the cron log?

I don't know where that is.

Quote:

Originally Posted by TB0ne (Post 3941446)
Did both xmessage and gxmessage give you the same results?

Yes.

Quote:

Originally Posted by TB0ne (Post 3941446)
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.

TB0ne 04-20-2010 01:57 PM

Quote:

Originally Posted by MTK358 (Post 3941451)
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.

MTK358 04-20-2010 02:14 PM

Quote:

Originally Posted by TB0ne (Post 3941660)
Different commands work differently. Try the xmessage in a small shell script, and see what it does.

It didn't work.

michaelk 04-20-2010 02:26 PM

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.

MTK358 04-20-2010 02:35 PM

It works:

Code:

* * * * * /usr/bin/xmessage -display :0.0 'this is a message'

TB0ne 04-20-2010 02:36 PM

Quote:

Originally Posted by michaelk (Post 3941685)
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.


All times are GMT -5. The time now is 04:42 PM.