[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Xmessage and at/atd command scheduling ("can't open display")



Hi,


I am trying to setup a little reminder system for myself using
the at(1) command scheduler and xmessage, so that by running a
shell script I can just type in what I want to be reminded of
and when, and when the time is up xmessage pops up in my face
with the reminder. The problem is that I just get a message
from "at" saying "Error: Can't open display:"

If I were to do the same using cron, I would place a line
saying, e.g. DISPLAY=:0.0 at the top of my crontab file and
then it works, but I cannot figure out where to place a similar
instruction for "at" so that it picks up my $DISPLAY?

Hope someone can help.

Btw. the script (taken from somewhere, long ago) looks like this:

  #!/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/tmp/message.$$
          fi
  done
  
  cat << !!
  
  Enter time and day you want to receive
  the message, for example:
  
          0815 jan 24
          08:15 tomorrow
          now + 1 day
          1700 Friday
  
  Then press Enter.
  
  !!
  
  read TIME
  
  at $TIME << !!
  
  /usr/bin/X11/xmessage -file $HOME/tmp/message.$$
  
  #mail -s husk < $HOME/tmp/message.$$ mojo@localhost
  rm -f $HOME/tmp/message.$$
  
  !!
  
  at -l
  
  exit 0


Morten



Reply to: