Operating System - HP-UX
1754393 Members
2748 Online
108813 Solutions
New Discussion

How to set DISPLAY variable thru cron when no tty

 
Frank de Vries
Respected Contributor

Re: How to set DISPLAY variable thru cron when no tty

Andrew

No, DISPLAY has not value it must be
a formulea. But it certainly should
not have a fixed value, it must be
dynamically exported.

Compare it to the PS1 variable for prompt.
It is not supposed to be fixed either.

To answer your question on X11.
So the value of the formulea DISPLAY is
filled in.
An example:
You can test this with the hpterm command.
Log in from various terminals, put at
the end of the password file not /sbin/sh
but ../x11/hpterm -toolkitoptions and
it will send it. In reflectionX you can
even make a macro that when the pc boots
you get the application, user wouldn't be
none the wiser it came from a Unix box.

(I know that is pretty insecure, that is why we prefer to do it on software level
Thus replace the above idea with javaX)

BUT, and here we go again, the value can
only be resolved if there is a tty.
Which funny enough there is after cron has
started the Application, because if you
check with who -u you see who is connected.
But the DISPLAY formulea is foobar by cron,
wam bam thank you mam

Cron is Gregory Peck;)
and I am Brahms and List !!



Look before you leap
Andrew Merritt_2
Honored Contributor

Re: How to set DISPLAY variable thru cron when no tty

Frank,
I'm sorry, I've failed. I'm just not able to explain so you can understand. I can't quite put my finger on what it is you're missing, but the issue is that when cron runs the script, there is no connection, so no 'tty' or any other connection from which to deduce a DISPLAY value. Yes, when you connect with hpterm, or look after a client has connected to the WS server, then you have a value, but that is not so when cron runs the script. Imagine the script running on a server with no cables (apart from power!) connected, and that is the situation.

I'm really giving up now, this is my last post on this!

Andrew