EntropySink

Please login or register.

Login with username, password and session length
Advanced search  

News:

News

Author Topic: shell scripting  (Read 415 times)

ober

  • Sam's Bitch
  • Ass Wipe
  • Karma: +66/-786
  • Posts: 8538
  • mini-ober is taking over
    • Windy Hill Productions
shell scripting
« on: July 10, 2009, 10:52:59 AM »

Hey all, not sure if any of you will know this or not, but here is my dilemma:

We login to a network of servers connected by LDAP.  Most of the time my scripts login, grab something, store it in my local directory and exit the remote server.  We run an ASP service and sometimes I have to login and watch our server logs to find a problem.  So I've written the most simple script that reads in the server you want to go to and then ssh's to the server, and changes the directory to the log directory.  The problem is that it doesn't leave me in that server.  I want the script to end and I'll be on the other server in the log directory so I can pick my log and tail it.

Looks like this:

Code: [Select]
echo "Enter Server ID"
read server
ssh -t as-$server "
cd /opt/oracle/restofpathtoOraclelogs
"

No exit, no nothing.  But when the script completes, it dumps me back to the original server I logged into.

Any ideas?

tgm

  • Guitar Addict
  • Jackass VI
  • Karma: +45/-17
  • Posts: 2786
    • http://aaronhanson.net/
Re: shell scripting
« Reply #1 on: July 10, 2009, 05:05:03 PM »

Why don't you just SSH normally? Is there more going on in your script?
Logged
One is not sure if one resents, or resembles that remark, one is not sure what it means............

ober

  • Sam's Bitch
  • Ass Wipe
  • Karma: +66/-786
  • Posts: 8538
  • mini-ober is taking over
    • Windy Hill Productions
Re: shell scripting
« Reply #2 on: July 13, 2009, 08:43:43 AM »

What do you mean "ssh normally"?  Meaning switch to the server and then run a script to change the directory?  I guess I could do that.  And I just tried that, but it won't do the "cd".  WTF.

edit: the whole point of adding the SSH part to the script was to avoid extra typing (I'm lazy and the servers all have a similar naming structure).

KnuckleBuckett

  • Jackass VII
  • Karma: +26/-254
  • Posts: 5468
  • Wilson Sophia 2...
Re: shell scripting
« Reply #3 on: July 13, 2009, 09:34:05 AM »

Try opposing the phrase branch.
Logged
2004 VW Turbo Diesel 43MPG AVG

KnuckleBuckett

  • Jackass VII
  • Karma: +26/-254
  • Posts: 5468
  • Wilson Sophia 2...
Re: shell scripting
« Reply #4 on: July 13, 2009, 09:34:20 AM »

 :lol:
Logged
2004 VW Turbo Diesel 43MPG AVG

ober

  • Sam's Bitch
  • Ass Wipe
  • Karma: +66/-786
  • Posts: 8538
  • mini-ober is taking over
    • Windy Hill Productions
Re: shell scripting
« Reply #5 on: July 13, 2009, 01:04:22 PM »

:p

tgm

  • Guitar Addict
  • Jackass VI
  • Karma: +45/-17
  • Posts: 2786
    • http://aaronhanson.net/
Re: shell scripting
« Reply #6 on: July 13, 2009, 01:59:01 PM »

What do you mean "ssh normally"?  Meaning switch to the server and then run a script to change the directory?  I guess I could do that.  And I just tried that, but it won't do the "cd".  WTF.

edit: the whole point of adding the SSH part to the script was to avoid extra typing (I'm lazy and the servers all have a similar naming structure).

That's sort of what I figured. I add shell aliases and symlinks to make life easier on the boxes. I'm beginning to find it quite useful to have a robust profile as I start living more of my life from the command line.

And I use putty for my SSH client, so I don't have to type in any server names or anything.
Logged
One is not sure if one resents, or resembles that remark, one is not sure what it means............

ober

  • Sam's Bitch
  • Ass Wipe
  • Karma: +66/-786
  • Posts: 8538
  • mini-ober is taking over
    • Windy Hill Productions
Re: shell scripting
« Reply #7 on: July 13, 2009, 03:07:20 PM »

I'm using secureCRT.  I'm not sure how you would get away without entering a servername/IP unless you are talking about when you start a new session?  And maybe I should explain that further.  We login to a cluster of servers that are under LDAP.  Then we SSH to the other servers from that single login (and we have a roaming profile that we're always attached to).  Typically you'd have to login to each server that you SSH to, but we've tricked it so that it keeps the login info so that it will login automatically when you SSH to another box.
 

Page created in 0.101 seconds with 16 queries.