RE: [ILUG] Running command after login.

From: Dave Airlie (airlied at domain csn.ul.ie)
Date: Thu 27 Sep 2001 - 13:40:59 IST


the problem with rsh is it doesn't do tty assigning for remote
commands... only for remote logins if I remember correctly...

my own take is to find an ENV variable that rsh transfers to the other
side and then feck with the /etc/csh.login /etc/profile to check is the
ENV set and if it is execute the script.. you might be using an
environment variable that isn't supposed to do this like DISPLAY or someat
but a bit of overloading doesn't affect much :-)

Dave.

On Thu, 27 Sep 2001, Aherne Peter-pahern02 wrote:

> Ok, try to reply to both Niall and Dave in this one.
>
> Dave first.
>
> Exactely what I want to do:
>
> Write a script, first thing the script does is check what machine they are on, if they are on the right one do something, if not ask them to choose from a list of servers, they choose, they get logged onto that machine, now I want to run the same script again automagically, this time they will be on the right machine so it will pass the server choice thing and work away.
>
> So thats what I want to do in case that gives people any more ideas.
>
> As for Niall.
>
> This could do the job for me, but since the machines are down at the mo I'll have to wait to test it out.
>
> >not an option, I've a sneaking suspicion you're perhaps using the group for
> >free help with some other *ix :-) in which case you may not have bash and
>
> </Grins Sheepishly> Lets just pretend I'm using a Linux box with no ssh then the problem is kinda platform independant. And your right, I dont have bash either - really I have a very minimal Linux installation :-)
>
> Thanks for all the help guys, gives me more options to play with.
> Peter.
>
> --
> Peter Aherne, Software Engineer, Motorola Ireland Ltd.
> http://www.skynet.ie/~peter - peter at domain linux.ie
> Ph: +353 21 4511234 Mobile: +353 87 2246834
>
>
> -----Original Message-----
> From: Niall O Broin [mailto:niall at domain linux.ie]
> Sent: 27 September 2001 12:49
> To: 'ilug at domain linux.ie'
> Subject: Re: [ILUG] Running command after login.
>
>
> On Thu, Sep 27, 2001 at 12:09:00PM +0100, Aherne Peter-pahern02 wrote:
>
> > Actually what I need is
> >
> > if (`userchoice` == "server1")
> >
> > rsh hostname command1 #Then god damn stay in the host
> > else
> >
> > rsh hostname command2 #Then god damn stay in the host
>
> OK - here's an answer which nearly works. Create a shell script called
> command1 (or whatever) which simply has
>
> #!/bin/sh
> real_command1
> exec bash -i
>
>
> I say this nearly works for two reasons:
>
> I tested it on Linux using bash, the default Linux shell. As you say ssh is
> not an option, I've a sneaking suspicion you're perhaps using the group for
> free help with some other *ix :-) in which case you may not have bash and
> you may have to invoke the shell differently.
>
> The remote environment is not set up correctly. The terminal type was not
> picked up in my tests, and even when I set the terminal type manually the
> arrow keys still did not work. Fixing these trivia is either a) unimportant
> or b) left as an exercise for the reader. (BTW bash --login didn't work for
> me in case that occured to anyone. bash --login -i did work but was just the
> same)
>
>
> That should put you on the path to righteousness. If you'd like a complete
> solution with bells and whistles, please feel free to contact me privately
> to arrange some consultancy :-)
>
>
>
> Niall
>
>

-- 
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at domain skynet.ie
pam_smb / Linux DecStation / Linux VAX / ILUG person


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:20 GMT