lmjm@doc.ic.ac.UK (05/06/87)
Depending on your local setup and the energy of your systems administrators you can probably run commands on another host on your local ethernet by just doing: remotehost "ls ~uucp" Here is a version of the MAKEHOSTS script that sits in /usr/hosts and crunches up the /etc/hosts file and generates all the symbolic links from hostname->/usr/ucb/rsh. I've extended it to also generate a link for each host:- xhostname->/usr/hosts/host_in_window. A little shell script that does (effectively) xterm -n "rlogin:remotehost" -e remotehost ... Please check it out before installing it!!! It works ok locally but may cause grief your system if you differ from 4.2 (beats me how - I am just cautious). Notes:- A symbolic link to host_in_window may be unnecessary if they are both on the same disc; It isn't fast; You'll probably want to change the options given to xterm and maybe even its location (I usr /usr/new/xterm); I though about an xinit like way of allowing some of the args to go to the xterm - but I never did anything about it. Have fun Lee (I wonder why my shar just dumped?? Oh well here it is as files.) MAKEHOSTS ------------------------------------------------------------------------------ #! /bin/sh -x # Create both the ordinary <machine-name> type commands AND # x<machine-name> which runs in its own window under X. cd ${DESTDIR}/usr/hosts mv MAKEHOSTS .MAKEHOSTS mv host_in_window .host_in_window rm -f * for i in `grep -v '^#' ${DESTDIR}/etc/hosts | awk '{print $2}'`; do ln -s /usr/ucb/rsh $i ln -s /usr/hosts/host_in_window x$i done mv .MAKEHOSTS MAKEHOSTS mv .host_in_window host_in_window ------------------------------------------------------------------------------ host_in_window ------------------------------------------------------------------------------ #! /bin/sh MC=`basename $0 | sed "s/^x//"` /usr/new/xterm -n "rlogin:$MC" -e $MC $* ------------------------------------------------------------------------------ -- UKUUCP SUPPORT Lee McLoughlin "What you once thought was only a nightmare is now a reality!" Janet: lmjm@uk.ac.ic.doc, lmcl@uk.ac.ukc DARPA: lmjm@doc.ic.ac.uk (or lmjm%uk.ac.ic.doc@cs.ucl.ac.uk) Uucp: lmjm@icdoc.UUCP, ukc!icdoc!lmjm
bob@osu-eddie.UUCP (05/06/87)
In article <8705052221.a004255@ivax.doc.ic.ac.uk> lmjm@doc.ic.ac.UK writes: > ... A little shell script that does (effectively) > xterm -n "rlogin:remotehost" -e remotehost ... > ... >#! /bin/sh >MC=`basename $0 | sed "s/^x//"` >/usr/new/xterm -n "rlogin:$MC" -e $MC $* > ... >UKUUCP SUPPORT Lee McLoughlin I've noticed a lot of people do the sort of thing you suggest. But why not run the xterm (or any other) client on the remote host where it belongs? If you can rlogin to a host, then you can rsh on it, which means you can have a little script called something like `rXcmd' so you can say rXcmd host /usr/local/xterm or, if you use GNU Emacs and want the full X interface, rXcmd host /usr/local/emacs What is rXcmd? It looks like: ---------------------------------------------------------------- #!/bin/sh # rXcmd (suggested by John Robinson, jr@bbn.com) case $# in [01]) echo "Usage: $0 host X-cmd [args...]";; *) host="$1"; shift xhost "$host" rsh "$host" -n "(setenv TERM xterm; setenv DISPLAY `hostname`:0; $*)" & ;; esac ---------------------------------------------------------------- Thanks, John, for this nifty little bit. It's the Right Way. -=- Bob Sutterfield, Department of Computer and Information Science The Ohio State University; 2036 Neil Ave. Columbus OH USA 43210-1277 bob@ohio-state.{arpa,csnet} or ...!cb{osgd,att}!osu-eddie!bob (614)292-7348 (office) or -0915 (operators) or -7325 (answering machine)