wow now this one actually worked, thank you.

Jason Jorgensen wrote:

> The best way is to do this with ssh and keys.
>
> But I wrote you a script for this. I dont think you should have to change anything in the
> script. Though the enviroment variable assignment is BASH only.
>
> Andrew Nemchenko wrote:
>
> > Yes I do have expect available, and I could use it, so if you can write it in expect..
> > The reason that I dont use ssh, is because I dont want to set it up on every machine.
> > While using a script like this, is fast and easy. Also I'm not worried about security
> > since all these machines are on internal lan. Using ssh would just be too much of a
> > hasle.
> >
> > Jim Crumley wrote:
> >
> > > On Fri, Jun 01, 2001 at 11:34:51AM +0100, Andrew Nemchenko wrote:
> > > >
> > > > I need a script that would do this for me:
> > > >
> > > > xhost krypton
> > > > rlogin krypton
> > > > (enter login name)
> > > > (enter password)
> > > > export DISPLAY=my_ip_goes_here:0.0
> > > > sunapp(an application that I need to run)
> > > >
> > > > if some one could please write a script that can do this for me I would really
> > > > apreciate it. I could probably do it my self but I left my bash book at home, and
> > > > dont want to puts around the man pages.
> > >
> > > Any particular reason not to use ssh?   With ssh properly setup,
> > > all you'd have to do is "ssh kryton sunapp".  (Of course, you
> > > may not have perms to setup ssh.)
> > >
> > > Anyway, to do this right, you probably want to expect, instead of
> > > bash.  That's because entering login names and passwords requires
> > > waiting till you're prompted for them.  That's a pain to do with
> > > regualr shells, but its expects bread and butter.  So, do you
> > > have expect available? I'd write the script, if you do.
> > >
> > > --
> > > Jim Crumley                  |
> > > crumley at fields.space.umn.edu |
> > > Work: 612 624-6804 or -0378  |
> > > _______________________________________________
> > > tclug-list mailing list
> > > tclug-list at mn-linux.org
> > > https://mailman.mn-linux.org/mailman/listinfo/tclug-list
> >
> > ------ http://USFamily.Net/info - Unlimited Internet - From $8.99/mo! ------
>
>   ------------------------------------------------------------------------
> #!/usr/bin/expect --
> #Hack together expect script to set the display enviroment variable on a remote machine.
>
> if {$argc==0} {
>   send_user "usage: $argv0 <HOSTNAME OR IP> <USER> <PASSWORD> <DISPLAY SETTING ie.15.15.15.15:0.0> <REMOTE APP TO LAUNCH>\n\n"
>   exit
> }
> # HOSTNAME = [lindex $argv 0]
> # USERNAME = [lindex $argv 1]
> # USERPASSWORD = [lindex $argv 2]
> # DISPLAYENV = [lindex $argv 3]
> # APP = [lindex $argv 4]
>
> exp_version -exit 5.0
> expect_before -i $user_spawn_id \003 exit
> set timeout 5
> stty -echo
>
> set pid [spawn xhost [lindex $argv 0]]
> expect
> exec kill $pid
>
> set pid [spawn rlogin -l [lindex $argv 1] [lindex $argv 0]]
>   expect "assword:" {
>   send_user "[lindex $argv 2]"
>   send "[lindex $argv 2]\r"
>   } eof {
>     send_user "rlogin spawn failed\n"
>     exec kill $pid
>     exit 1
>   } timeout {
>     send_user "\n ## Never saw password prompt.\n"
>     exit 1
>   }
>
>   ## At a prompt Switch enter enviroment variable
>   expect -re "(#|>|\\\$|%)" {
>   send "export DISPLAY=[lindex $argv 3]\n"
>   } eof {
>     send_user "\n ## rlogin spawn failed\n"
>     exec kill $pid
>     exit 1
>   } timeout {
>     send_user "\n ## Never saw command prompt.\n"
>     exit 1
>   }
>
>   ## At the next prompt lauch the app
>   expect -re "(#|>|\\\$|%)" {
>   send "[lindex $argv 4]&\n"
>   } eof {
>     send_user "\n ## rlogin spawn failed\n"
>     exec kill $pid
>     exit 1
>   } timeout {
>     send_user "\n ## Never saw command prompt.\n"
>     exit 1
>   }
>
>   ## At the next prompt exit the rlogin
>   expect -re "(#|>|\\\$|%)" {
>   send "exit\n"
>   } eof {
>     send_user "\n ## rlogin spawn failed\n"
>     exec kill $pid
>     exit 1
>   } timeout {
>     send_user "\n ## Never saw command prompt.\n"
>     exit 1
>   }
>
> set timeout 60
> expect
> exec kill $pid
> exit



------ http://USFamily.Net/info - Unlimited Internet - From $8.99/mo! ------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drew.vcf
Type: text/x-vcard
Size: 265 bytes
Desc: Card for Andrew Nemchenko
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20010601/e443bfff/drew.vcf