<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to set DISPLAY variable thru cron when no tty in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942776#M793496</link>
    <description>Hi,&lt;BR /&gt;You cannot set a fancy DISPLAY like that for cron usage... since you shell is not interactive.&lt;BR /&gt;If you wish to do  so, you will have to setup a virtual frame buffer server or appropiate software (xvnc):&lt;BR /&gt;Look at this link:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=758230" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=758230&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;Victor</description>
    <pubDate>Thu, 24 Nov 2005 10:20:03 GMT</pubDate>
    <dc:creator>Victor BERRIDGE</dc:creator>
    <dc:date>2005-11-24T10:20:03Z</dc:date>
    <item>
      <title>How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942767#M793487</link>
      <description>I have a startup script to start &lt;BR /&gt;the WebSphere server.&lt;BR /&gt;&lt;BR /&gt;To run the client components (java) from the server we need to export the DISPLAY variable&lt;BR /&gt;on the command line. This works fine.&lt;BR /&gt;&lt;BR /&gt;I have taken it a step further and automated my startup that the DISPLAY is dynamically set so that after our login via telnet&lt;BR /&gt;or reflexionX telnet we do not need to&lt;BR /&gt;do export DISPLAY=blabla:0.0, because&lt;BR /&gt;it is already set. This works great!!&lt;BR /&gt;&lt;BR /&gt;How do I do that?&lt;BR /&gt;Like this:&lt;BR /&gt;--------------------------------&lt;BR /&gt;tty&lt;BR /&gt;TTY=$(eval tty | awk -F "/dev/" {' print $2'})&lt;BR /&gt;DISPLAY=$(who -u | grep $TTY | awk {' print $8 '}):0.0&lt;BR /&gt;export DISPLAY&lt;BR /&gt;----------------------------------&lt;BR /&gt;This works fine !!&lt;BR /&gt;&lt;BR /&gt;But now I used this same script in the cron to &lt;BR /&gt;stop the WebSphere server on weekends&lt;BR /&gt;and start it again and I get a message&lt;BR /&gt;in the log:&lt;BR /&gt;+ tty&lt;BR /&gt;not a tty&lt;BR /&gt;+ awk -F /dev/ { print $2}&lt;BR /&gt;+ eval tty&lt;BR /&gt;+ tty&lt;BR /&gt;+ export TTY=&lt;BR /&gt;+ + who -u&lt;BR /&gt;+ awk { print $8 }&lt;BR /&gt;+ grep&lt;BR /&gt;usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] -e pattern_list...&lt;BR /&gt;        [-f pattern_file...] [file...]&lt;BR /&gt;usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] [-e pattern_list...]&lt;BR /&gt;        -f pattern_file... [file...]&lt;BR /&gt;usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] pattern [file...]&lt;BR /&gt;DISPLAY=:0.0&lt;BR /&gt;&lt;BR /&gt;So yeah that makes sense, cron that not&lt;BR /&gt;use tty. Still I would like the DISPLAY&lt;BR /&gt;to be set, how to do that ?&lt;BR /&gt;&lt;BR /&gt;Is there a workaround to set the DISPLAY&lt;BR /&gt;at all in cron or is it a no go ?&lt;BR /&gt;&lt;BR /&gt;Tx</description>
      <pubDate>Thu, 24 Nov 2005 05:33:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942767#M793487</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-24T05:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942768#M793488</link>
      <description>Do you have sudo utility. Cron execution of tty will return only not a tty bcas cron will not use any tty so that tty execution will give that.&lt;BR /&gt;&lt;BR /&gt;Try to put this in a script and execute with sudo utility.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 24 Nov 2005 05:54:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942768#M793488</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-24T05:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942769#M793489</link>
      <description>* * * * * tty &amp;gt;&amp;gt; /tmp/test.log&lt;BR /&gt;cron tab is saying that not a tty. You have to execute tty command by that user only. &lt;BR /&gt;&lt;BR /&gt;Refer this:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=973600" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=973600&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Use sudo utility to execute a command by that user itself.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 24 Nov 2005 05:59:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942769#M793489</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-24T05:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942770#M793490</link>
      <description>Muthu&lt;BR /&gt;&lt;BR /&gt;I am not entirely with you.&lt;BR /&gt;&lt;BR /&gt;Yes we use sudo !!&lt;BR /&gt;&lt;BR /&gt;But I fail to see the relationship between&lt;BR /&gt;running cron and using sudo.&lt;BR /&gt;I am curious as to what you mean.&lt;BR /&gt;Thx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Nov 2005 06:00:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942770#M793490</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-24T06:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942771#M793491</link>
      <description>when you run tty command with cron then, cron will execute that command. cron is not having any tty informations so that it is returning as not a tty.&lt;BR /&gt;&lt;BR /&gt;tty informations can be only taken by root and normal users (those who can login with terminal).&lt;BR /&gt;&lt;BR /&gt;Create a script like,&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#display.ksh&lt;BR /&gt;PATH=$PATH:/usr/bin&lt;BR /&gt;tty&lt;BR /&gt;TTY=$(eval tty | awk -F "/dev/" {' print $2'})&lt;BR /&gt;DISPLAY=$(who -u | grep $TTY | awk {' print $8 '}):0.0&lt;BR /&gt;export DISPLAY&lt;BR /&gt;exit 0&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;cron tab entry&lt;BR /&gt;===========&lt;BR /&gt;&lt;BR /&gt;x x x x x &lt;SUDO syntax="" to="" execute=""&gt; /display.ksh 1&amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;Now it will work.&lt;BR /&gt;&lt;/SUDO&gt;</description>
      <pubDate>Thu, 24 Nov 2005 06:06:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942771#M793491</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-24T06:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942772#M793492</link>
      <description>Ah, I see what you mean.&lt;BR /&gt;You assumed I need root privileges ?&lt;BR /&gt;&lt;BR /&gt;I had not listed my cronjob:&lt;BR /&gt;35 9 * * 4 su - root -c "/etc/cmcluster/devnew/WebSphere_Start.sh &amp;gt; /tmp/WebSphere_Start_devnew.cronlog 2&amp;gt;&amp;amp;1"&lt;BR /&gt;&lt;BR /&gt;The scripts is run as a root user,&lt;BR /&gt;and with with that user there is not&lt;BR /&gt;tty attached when scheduled by cron.&lt;BR /&gt;&lt;BR /&gt;Hence my DISPLAY is not set properly.&lt;BR /&gt;&lt;BR /&gt;I am looking for a workaround for that.&lt;BR /&gt;&lt;BR /&gt;For clarity: I am not looking for a way&lt;BR /&gt;to promote my user with SUDO or otherwise&lt;BR /&gt;to attain certain privileges.&lt;BR /&gt;&lt;BR /&gt;Hope others have a better idea?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Nov 2005 06:10:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942772#M793492</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-24T06:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942773#M793493</link>
      <description>You can change DISPLAY setting script as,&lt;BR /&gt;&lt;BR /&gt;DISPLAY="$(who -mu | awk '{ print $8 }'|xargs getip):0.0"&lt;BR /&gt;&lt;BR /&gt;It will not need any TTY settings.&lt;BR /&gt;&lt;BR /&gt;not a tty standard input is not a terminal or pseudo-terminal for tty.&lt;BR /&gt;&lt;BR /&gt;May be execution with cron is pseudo-terminal.</description>
      <pubDate>Thu, 24 Nov 2005 06:18:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942773#M793493</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-24T06:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942774#M793494</link>
      <description>Hmmm I hadn't thought of that -mu&lt;BR /&gt;looks like a winner,&lt;BR /&gt;I will try it after lunch.</description>
      <pubDate>Thu, 24 Nov 2005 06:31:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942774#M793494</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-24T06:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942775#M793495</link>
      <description>Muthu&lt;BR /&gt;&lt;BR /&gt;Do you try the stuff that you advice ?&lt;BR /&gt;Because it appears your axioma that &lt;BR /&gt;tty is not used is incorrect.&lt;BR /&gt;&lt;BR /&gt;I received error on your line:&lt;BR /&gt;DISPLAY="$(who -mu |awk '{ print $8 }'|xargs getip):0.0"&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;+ + who -mu&lt;BR /&gt;+ awk { print $8 }&lt;BR /&gt;+ xargs getip&lt;BR /&gt;process not attached to terminal&lt;BR /&gt;Usage:  who [-rbtpludAasHTqRm] [am i] [utmp_like_file]&lt;BR /&gt;&lt;BR /&gt;r       run level&lt;BR /&gt;b       boot time&lt;BR /&gt;t       time changes&lt;BR /&gt;p       processes other than getty or users&lt;BR /&gt;l       login processes&lt;BR /&gt;u       useful information&lt;BR /&gt;d       dead processes&lt;BR /&gt;A       accounting information&lt;BR /&gt;a       all (rbtpludA options)&lt;BR /&gt;s       short form of who (no time since last output or pid)&lt;BR /&gt;H       print header&lt;BR /&gt;T       status of tty (+ writable, - not writable, x exclusive open, ? hung)&lt;BR /&gt;q       quick who&lt;BR /&gt;R       print host name&lt;BR /&gt;Usage: getip host&lt;BR /&gt;DISPLAY=:0.0&lt;BR /&gt;+ export DISPLAY&lt;BR /&gt;------------------------------&lt;BR /&gt;&lt;BR /&gt;Sorry I can't give any points for that.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Nov 2005 08:49:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942775#M793495</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-24T08:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942776#M793496</link>
      <description>Hi,&lt;BR /&gt;You cannot set a fancy DISPLAY like that for cron usage... since you shell is not interactive.&lt;BR /&gt;If you wish to do  so, you will have to setup a virtual frame buffer server or appropiate software (xvnc):&lt;BR /&gt;Look at this link:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=758230" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=758230&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;Victor</description>
      <pubDate>Thu, 24 Nov 2005 10:20:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942776#M793496</guid>
      <dc:creator>Victor BERRIDGE</dc:creator>
      <dc:date>2005-11-24T10:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942777#M793497</link>
      <description>I think you just need to hard-code a value for DISPLAY in the script you run from cron.  Since normally you are extracting the information from the login information (from the 'who -u' output), you can't do this for cron since there  is no login session associated with running the script from cron.  What is it you want to set DISPLAY to when running from cron?  That's not something we can tell you; where do you want the output to appear?&lt;BR /&gt;&lt;BR /&gt;If you want to use the same script, then perhaps you test the result of 'tty' to see if you have a tty value; if not use the value you want to use for cron, otherwise continue as you already do.&lt;BR /&gt;&lt;BR /&gt;Andrew</description>
      <pubDate>Thu, 24 Nov 2005 10:36:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942777#M793497</guid>
      <dc:creator>Andrew Merritt_2</dc:creator>
      <dc:date>2005-11-24T10:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942778#M793498</link>
      <description>cron does not login. It runs programs on behalf of the user which owns the cron job. And because there is no user present at a keyboard, there is no tty device. That means several things: no tty commands will work, things like tabs, ttytype, tty, etc. It also means that there is no terminal associated with the job that is being run. The who command works only with tty devices, and if you think about it, how would who -muR pick an IP address? There is no one logged into this cron job so it is impossible to pick the 'correct' DISPLAY value. &lt;BR /&gt; &lt;BR /&gt;So as suggested, you must hardcode the DISPLAY variable in your script. HOWEVER: the DISPLAY computer (a PC in this case, which is running Reflection/X) must *never* be logout, shutdown or rebooted. The display screen (which is Windows plus Reflection/X) must always be ready to display something from cron.&lt;BR /&gt; &lt;BR /&gt;Now here's the question: who is going to be sitting in front of the PC when this cron job runs? Does this cronjob require someone to answer questions? Requiring a display device, whether it is a simple ASCII terminal or a graphics program in order to startup seems like a very poor design.</description>
      <pubDate>Thu, 24 Nov 2005 12:04:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942778#M793498</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-11-24T12:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942779#M793499</link>
      <description>I might be missing something, but if you are getting tty error in a cron (which makes sence) and obviously you do not require tty's when running from a cron. In you .profile (or the script which runs the tty command) Put the tty commands in a if stmt to be ignored. ie&lt;BR /&gt;&lt;BR /&gt;if [ "$TERM"  -a "$DISPLAY" ]; then&lt;BR /&gt;#       Set up the terminal:&lt;BR /&gt;  if [ "$TERM" = "" ]&lt;BR /&gt;  then&lt;BR /&gt;    eval ` tset -s -Q -m ':?dtterm' `&lt;BR /&gt;  else&lt;BR /&gt;    eval ` tset -s -Q `&lt;BR /&gt;  fi&lt;BR /&gt;stty erase \^H intr \^c kill \^u eof \^d susp \^z echoe echok&lt;BR /&gt;stty hupcl ixon ixoff&lt;BR /&gt;tabs&lt;BR /&gt;  set -o vi&lt;BR /&gt;  prompt="[\!] # "&lt;BR /&gt;  export PS1=`/usr/ucb/whoami`@:`uname -n`:'$PWD'${prompt}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;you could get even fancier by added &lt;BR /&gt;   if [ ! "$VUE" ]; then&lt;BR /&gt;...&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;Also for interest sake you can get the DISPLAY using the following 1 line as opposed to the 2 lines given above.&lt;BR /&gt;&lt;BR /&gt;DISPLAY=`who -mR | sed "s=.*(==;s=[:)].*=="`:0.0&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Nov 2005 22:44:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942779#M793499</guid>
      <dc:creator>Ron Gordon</dc:creator>
      <dc:date>2005-11-24T22:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942780#M793500</link>
      <description>Hi,&lt;BR /&gt;Andrew&lt;BR /&gt;&lt;BR /&gt;You anwser my question with more questions.&lt;BR /&gt;Interesting :)&lt;BR /&gt;&lt;BR /&gt;I clarify:&lt;BR /&gt;&lt;BR /&gt;I clearly mentioned it concerned a &lt;BR /&gt;startup script for WebSphere.&lt;BR /&gt;So any client (pc) that contacts the server&lt;BR /&gt;can only receive a session back if &lt;BR /&gt;the DISPLAY variable can be set dynamically.&lt;BR /&gt;A static DISPLAY just won't cut it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2005 03:19:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942780#M793500</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-28T03:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942781#M793501</link>
      <description>Many replies , a lot of ideas, but no solution as yet.&lt;BR /&gt;&lt;BR /&gt;Ron , you missed the point about my tty&lt;BR /&gt;command , that was for your benefit, I put&lt;BR /&gt;it there purposfully.&lt;BR /&gt;Still thanks for you one-liner, I will&lt;BR /&gt;add that to my collection :)&lt;BR /&gt;&lt;BR /&gt;Bill:&lt;BR /&gt;Your answer seems the most mature.&lt;BR /&gt;It is a graphics env in java, trying to&lt;BR /&gt;send back a pdf on the fly.&lt;BR /&gt;Probably you are right it is poor design,&lt;BR /&gt;but it wasn' t mine.&lt;BR /&gt;&lt;BR /&gt;But Java env must be started with &lt;BR /&gt;DISPLAY set. Problem in weekend we&lt;BR /&gt;stop and start with cron.&lt;BR /&gt;&lt;BR /&gt;Will have to find another way to stop/start,&lt;BR /&gt;maybe using rlogin or remsh or telnet localy,&lt;BR /&gt;to get this tty anyway.&lt;BR /&gt;&lt;BR /&gt;Thankx&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2005 03:56:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942781#M793501</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-28T03:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942782#M793502</link>
      <description>I'm afraid I don't know what Websphere is, so can't make any assumptions about what it does or how it works.  As for asking questions, that seems to be a reasonable way of requesting information :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;So any client (pc) that contacts the server&lt;BR /&gt;&amp;gt;can only receive a session back if&lt;BR /&gt;&amp;gt;the DISPLAY variable can be set dynamically.&lt;BR /&gt;&amp;gt;A static DISPLAY just won't cut it.&lt;BR /&gt;&lt;BR /&gt;Right, but what you're doing is restarting the server using cron, at which point you no longer have an active connection, so how do you know what you want to set the DISPLAY variable to?   Are you trying to reconnect to  a client that's talking to the server, or just restart a client that's run on the server machine and displays on a remote one?  Is the remote machine likely to always be up?&lt;BR /&gt;&lt;BR /&gt;Or are you saying you want to kill the server, which will kill the active connection (can there only be one, or many?), and re-open a connection to a client when you restart the server?  In that case, when the connection is originally made, you could save the value of DISPLAY to a file, and read it when you restart the server (of course, the client might have gone away in the interim).&lt;BR /&gt;&lt;BR /&gt;I'm sorry, but what you're trying to do with cron is not well described, or perhaps you don't fully understand what cron is and isn't capable of.&lt;BR /&gt;&lt;BR /&gt;Andrew&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2005 03:59:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942782#M793502</guid>
      <dc:creator>Andrew Merritt_2</dc:creator>
      <dc:date>2005-11-28T03:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942783#M793503</link>
      <description>Andrew&lt;BR /&gt;&lt;BR /&gt;Indeed I underestimated cron limitations,&lt;BR /&gt;you are right there. Is was aware of that,&lt;BR /&gt;but I was hoping for a workaround, trick,&lt;BR /&gt;whatever, cos one never knows everything.&lt;BR /&gt;&lt;BR /&gt;For me it is not necessary to know &lt;BR /&gt;beforehand the client who could come&lt;BR /&gt;knocking on the web server's door.&lt;BR /&gt;&lt;BR /&gt;As long the DISPLAY variable is dynamically&lt;BR /&gt;set.&lt;BR /&gt;&lt;BR /&gt;Compare this to your plain old X11telnet login: If you set (using the nice one liner from Ron) DISPLAY=`who -mR | sed "s=.*(==;s=[:)].*=="`:0.0&lt;BR /&gt;then you could login from any client,&lt;BR /&gt;and your unix server wouldn't know&lt;BR /&gt;which one beforehand, but your display&lt;BR /&gt;would be correctly set.&lt;BR /&gt;&lt;BR /&gt;Java works no different, only login is&lt;BR /&gt;replaced by software rendered connections&lt;BR /&gt;that's all. But still it needs the DISPLAY.&lt;BR /&gt;&lt;BR /&gt;Got the feeling I did more explaining on &lt;BR /&gt;this questions then I got ideas from it :) :)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2005 04:16:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942783#M793503</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-28T04:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942784#M793504</link>
      <description>Frank,&lt;BR /&gt; In the case of the telnet login, there is something that indicates where the connection is coming from, and you can set the DISPLAY variable based on that.&lt;BR /&gt;&lt;BR /&gt;But in the case where you are running the script in cron, there is no incoming connection, so I really don't see how you expect to determine what you want DISPLAY to be.  That's what I'm trying to understand.&lt;BR /&gt;&lt;BR /&gt;Andrew&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2005 04:24:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942784#M793504</guid>
      <dc:creator>Andrew Merritt_2</dc:creator>
      <dc:date>2005-11-28T04:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942785#M793505</link>
      <description>Hi again Frank,&lt;BR /&gt;&lt;BR /&gt;My previous post would have solved your problem...&lt;BR /&gt;We have a similar situation, and we need a display to capture pdfs...&lt;BR /&gt;We use vnc :&lt;BR /&gt;&lt;A href="http://www.realvnc.com/what.html" target="_blank"&gt;http://www.realvnc.com/what.html&lt;/A&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;(define a vnc server as display server)&lt;BR /&gt;/home/appoper:vncserver :4&lt;BR /&gt;&lt;BR /&gt;New 'saler:4 ()' desktop is saler:4&lt;BR /&gt;&lt;BR /&gt;Starting applications specified in /home/appoper/.vnc/xstartup&lt;BR /&gt;Log file is /home/appoper/.vnc/saler:4.log&lt;BR /&gt;&lt;BR /&gt;/home/appoper:export DISPLAY=localhost:4.0&lt;BR /&gt;/home/appoper:xhost +&lt;BR /&gt;access control disabled, clients can connect from any host&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;Victor</description>
      <pubDate>Mon, 28 Nov 2005 05:00:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942785#M793505</guid>
      <dc:creator>Victor BERRIDGE</dc:creator>
      <dc:date>2005-11-28T05:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to set DISPLAY variable thru cron when no tty</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942786#M793506</link>
      <description>Andrew&lt;BR /&gt;&lt;BR /&gt;I think you understand it, but now just&lt;BR /&gt;translate what you know to the java virtual machine which also can act as login daemons (only sofware rendered) as opposed to inetd deamon that listens to your login and spawns a getty and .profile in unix when connecting.&lt;BR /&gt;&lt;BR /&gt;Imagine this concept but transpose it &lt;BR /&gt;to java's logics and you'll see &lt;BR /&gt;it is no different in essence.&lt;BR /&gt;&lt;BR /&gt;As to the fact that is started by cron,&lt;BR /&gt;can maybe be compared when you&lt;BR /&gt;boot a unixserver there is also no user&lt;BR /&gt;connecting nor involved. Still it is quite legal to put in the root profile (other &lt;BR /&gt;other user's profile) the DISPLAY command dynamically (see Ron's oneliner), and then&lt;BR /&gt;connecting from a pc with e.g. reflectionX ,&lt;BR /&gt;it will attach a tty and with that with&lt;BR /&gt;who -u you can obtain the hostname of &lt;BR /&gt;the client. so DISPLAY can be programmed&lt;BR /&gt;on this basis with variables, except&lt;BR /&gt;thru cron unfort.&lt;BR /&gt;&lt;BR /&gt;Hope u c :) :)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2005 05:19:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-set-display-variable-thru-cron-when-no-tty/m-p/4942786#M793506</guid>
      <dc:creator>Frank de Vries</dc:creator>
      <dc:date>2005-11-28T05:19:16Z</dc:date>
    </item>
  </channel>
</rss>

