Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.windows.x Frequently Asked Questions (FAQ) 2/7
Section - 42) How do I keep my $DISPLAY when I rlogin to another machine?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Forum archive ]


Top Document: comp.windows.x Frequently Asked Questions (FAQ) 2/7
Previous Document: 41) Why isn't my PATH set when xdm runs my .xsession file?
Next Document: 43) How can I design my own font?
See reader questions & answers on this topic! - Help others by sharing your knowledge

There are several ways to avoid having to do a "setenv DISPLAY ..." whenever
you log in to another networked UNIX machine running X.

A trivial solution, if your account is cross-mounted on both machines, is to
have your .xsession write your DISPLAY variable to a file, and then in your
login dot-files to check for the existence of that that file and use its
contents as your DISPLAY. [Thanks to joachim.fricker@zh014.ubs.ubs.ch.]

One solution is to use the clients/xrsh on the R5 and R6 contrib tapes.  It
includes xrsh, a script to start an X application on remote machine, and
xrlogin, a script to start a local xterm running rlogin to a remote machine.
A more recent version is on export in contrib/utilities/xrsh-5.8.shar.gz
[21/94].

One solution is to use the xrlogin program from der Mouse
(mouse@larry.mcrcim.mcgill.edu). You can ftp caveat-emptor versions from
ftp.cim.mcgill.ca (132.206.4.7) in pub/people/mouse/X/xrlogin/.  The program
packages up $TERM and $DISPLAY into a single string, which is stuffed into
$TERM.  rlogin then propagates $TERM normally; your .cshrc on the remote
machine should contain

		eval `xrlogind`

where xrlogind is a program that checks $TERM and if it is of the special
format it recognizes, unpacks it and spits out setenv and unsetenv commands
to recreate the environment variables. [11/90]

In addition, if all you need to do is start a remote X process on another
host, and you find

		rsh <HOST> -n /usr/bin/X11/xterm -display $DISPLAY 

too simple (DISPLAY must have your real hostname), then this version of xrsh 
can be used to start up remote X processes. The equivalent usage would be 

		xrsh <HOST> xterm

  #! /bin/sh
  # start an X11 process on another host
  # Date: 8 Dec 88 06:29:34 GMT
  # From: Chris Torek <chris@mimsy.umd.edu>
  # rsh $host -n "setenv DISPLAY $DISPLAY; exec $@ </dev/null >&/dev/null"
  #
  # An improved version:
  # rXcmd (suggested by John Robinson, jr@bbn.com)
  #       (generalized for sh,ksh by Keith Boyer, keith@cis.ohio-state.edu)
  #
  # but they put the rcmd in ()'s which left zombies again.  This
  # script combines the best of both.
  
  case $# in
  [01])  echo "Usage: $0 host x-cmd [args...]";;
  *)
  	case $SHELL in
  	*csh*)  host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"setenv TERM xterm; setenv DISPLAY `hostname`:0; \
  			exec $* </dev/null >& /dev/null" &
  		;;
  	*sh)
  		host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"TERM=xterm export TERM; \
  			DISPLAY=`hostname`:0 export DISPLAY; \
  			LD_LIBRARY_PATH=/usr/X11/lib export LD_LIBRARY_PATH; \
  			PATH=\$PATH:/usr/X11/bin:/usr/bin/X11:/usr/local/bin; \
			export PATH; \
  			exec $* < /dev/null > /dev/null 2>&1" &
  		;;
  	esac
  	;;
  esac

You may also want to look at programs/rstart in the R6 distribution; this
remote execution protocol is intended to work in concert with session
managers.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.windows.x Frequently Asked Questions (FAQ) 2/7
Previous Document: 41) Why isn't my PATH set when xdm runs my .xsession file?
Next Document: 43) How can I design my own font?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)





Last Update March 27 2014 @ 02:12 PM