
Dumb Newbie Question: no $DISPLAY environment variable
Quote:
> I'm on RedHat 9 and I got the bright idea to use wish to remind to do
> some stuff. Just sending my standard email reminder isn't enough
> since I seem to ignore my new mail icon. I thought I could pop up a
> nice box in gnome with a short message.
> I was going to use crontab call the following script:
> #!/usr/bin/wish
> frame .mv
> pack .mv
> canvas .mv.c
> pack .mv.c
> button .mv.c.b -text "Run Friday backup" -command exit
> .mv.c create window 400 300 -window .mv.c.b
> But when it runs I get the following error:
> Application initialization failed: no display name and no $DISPLAY
> environment
> variable
> Error in startup script: invalid command name "frame"
> while executing
> "frame .mv"
> (file "/home/strycat/backupreminder line 3)
> Any help would be appreciated.
> Thanks,
> -Tom
Yes, well, when the job runs under cron, it does not inherit the
environment of a user logged in under X.
Your cron table entry could use the -display option to specify a
display. You have to make certain that whatever user cron is using has
the right to use the display.
i.e.
10 * * * * $HOME/myscript.tcl -display myworkstation:0:0 ...
in your cron table.
You may also need to do :
xhost +
after you log in under X (gnome, kde, whatever...) depending on your
security setup. You might also want to use a wrapper script that finds
out if you are logged in, so that other users don't get popup notices
that you should call your girlfriend/wife/mother etc.