Sending an xmessage from cron

Sending an xmessage from cron

Post by Mike Gree » Mon, 02 Sep 1996 04:00:00



I run a script via cron every hour that dials up my ISP and
retrieves my email.  This script checks if anyone is logged
on to my pc by running a who command and checking for
output.  If someone is online the slip connection will not
be dropped - if noone is online the slip connection is
dropped via dip -k.

If I happen to be using Xwindows and not have any terminal
sessions going on, the script will drop my connection.  This
is a bummer if I happen to be in the middle of ftp'ing a
file with netscape etc...

I found a workaround by checking to see if X is running
before the script drops the carrier.  Here is my dilemma.  I
want to be able to send a message with something similar to
xmessage that tells me the connection is about to drop and
gives me an option of aborting or not.  And, my question: Is
there any way to use xmessage to send the message from a
cron/at process that is not connected to the X display?  If
not xmessage, is there any other way to send a message to an
X session that will allow me limited interaction (yes or
no)?

Thanks in advance.....

 
 
 

1. Can I run xmessage using cron & at?

I've been trying to get a reminder script to launch an xmessage
window from cron. I can get it to send me mail, and the rm command
works, see below. But the xmessage window never appears, I've tried
using xon to start it as well but that doesn't work from cron. What
should I be using? Is this possible?

I got this from Linux Journal, and modified it.

#!/bin/sh

echo "Enter your reminder message.
When finished, enter a period (.) at
the beginning of a line and press enter.
 (Or press Ctrl-C or DEL to exit.)"

while :
do
        read MESSAGE
        if [ "$MESSAGE" = "." ]
        then
                break
        else
                echo $MESSAGE > $HOME/Msgs/message.$$
        fi
done

cat << !!
Enter time and day you want to receive
the message, for example:

        0815am Jan 24
        8:15am Jan 24
        now + 1 day
        5 pm Friday

Then press Enter.

!!
read TIME

echo "at $TIME xmessage $HOME/Msgs/message.$$"

at $TIME << !!
/usr/bin/X11/xmessage -file $HOME/Msgs/message.$$
rm -f $HOME/Msgs/message.$$
!!
exit 0

2. NPR/MPR 7/30 story on the Code Red Internet Worm

3. cron xmessage

4. Internet Server

5. CRON : Can you send values to CRON and get a result ?

6. Looking for info on ftpd/ftp

7. cron.deny and cron.allow files for CRON management

8. xf86config & ATI Mach64 device not found

9. How to prevent cron daemon from sending Emails to root@host ?

10. how to send files ( via ssh-ftp) from one linux to another linux in cron????

11. cron send mail only when an error occurs

12. Why won't cron send me mail?

13. Stopping Cron from sending E-Mails?