Dear all,
I am trying to write a shell script that creates a ssh tunnel to a remote server and checks out a module from a CVS repository. The problem is that the tunnel creation blocks the terminal. That means I have to wait for a moment till the tunnel is established and than apply the CVS commands on a different terminal. How can this be done with a shell script such that the process can be automatic? I already tried to put an ampersand after the ssh line, but then the connection is aborted at the time the CVS commands are entered. Thanks in advance.
Siebbel
This is what I tried: -
ssh -L 2401:localhost:2401 user@somewhere.com &
-
sleep 10
-
export CVSROOT=:pserver:cvs@localhost:/data/cvs
-
cvs update -d module &
-
4 2762
I googled a lot already but al methods offered did not work. I can fork the tunnel to the background for an amount of time using the command sleep, but then the connection is immediately closed: -
ssh -fv -L 2401:localhost:2401 cvs@colab.capitaltoolcompany.com sleep 25
-
<enter>
-
debug1: Authentication succeeded (publickey).
-
debug1: Connections to local port 2401 forwarded to remote address localhost:2401
-
debug1: Local forwarding listening on 127.0.0.1 port 2401.
-
debug1: channel 0: new [port listener]
-
debug1: Local forwarding listening on ::1 port 2401.
-
debug1: channel 1: new [port listener]
-
debug1: channel 2: new [client-session]
-
debug1: Entering interactive session.
-
[root@neptune html]# debug1: Sending command: sleep 25
-
Press Enter to close this session...
-
debug1: client_input_channel_req: channel 2 rtype exit-status reply 0
-
debug1: channel 2: free: client-session, nchannels 3
-
debug1: channel 0: free: port listener, nchannels 2
-
debug1: channel 1: free: port listener, nchannels 1
-
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
-
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
-
debug1: Exit status 0
-
Here I gave only the final part of the output, since the first part is what one expects when the tunnel is set up. After this output, no connection is available anymore, <enter> terurnes to prompt. I've looked at dozens of pages concerning ssh tunneling but no usefull comments till now. Can anybody help me?
Siebbel
It appears your source port and destination port are the same port on the same machine...Is that what you are trying to do?
This is also something I got from a ssh tutorial. And it works fine from the command line: when I enter -
ssh –v –a –L 2401:localhost:2401 user@remoteserver
-
an ssh tunnel is opened and through a different terminal I am able to send the commands I want to, or scp or whatever. The problem lies in the fact that I have to do that in a different terminal and a shell script is run from one. Using the -f option from the command line doesn't work (see output above), although this is how it is described in the literature.
Siebbel
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bob Swerdlow |
last post by:
My application starts up a number of processes for various purposes using:
self.popen = popen2.Popen3("/usr/local/bin/python -O "myscript.py")
and then shuts them down when appropriate with...
|
by: Jelle Feringa // EZCT / Paris |
last post by:
James, Terry,
Thanks for your constructive comments.
Let's see if we can come down to the heart of the matter, it seems to me
these are fundamental issues relevant in any shell script.
I'm...
|
by: John Abel |
last post by:
Hi!
I'm currently writing a script which launches external programs, but it
keeps leaving zombie/defunct processes behind, until I kill the
launching script, which is a bit of a pain, as it's...
|
by: Joe Lester |
last post by:
I'm trying to run PostgreSQL 7.4.1 on Mac OS 10.2.6. I'm running into
problems when the number of process for the postgres user reaches 100.
When that happens I get a "No More Processes" message in...
|
by: schreckmail |
last post by:
Hi all!
I'm launching a subprocess using the following code, and I'd like to
kill off all associated subprocesses after a given timeout:
myproc = popen2.Popen3(command)
Now, because the...
|
by: mandydhaliwal |
last post by:
Hi all,
I am porting a win32 c++ program on Linux which first reads a list of
processes and their paths from a file.Then this program should launch
all of thesese processes.
I tried to...
|
by: Michel Leunen |
last post by:
Hi,
I'm trying to write a python script for Nautilus.
To get the list of files selected in the Nautilus right pane, you use
the $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS environment variable which is...
|
by: Samuel A. Falvo II |
last post by:
I have a shell script script.sh that launches a Java process in the
background using the &-operator, like so:
#!/bin/bash
java ... arguments here ... &
In my Python code, I want to invoke...
|
by: replysonika |
last post by:
Hello,
I run a Java app with subprocess from Python script. This python
script is called from another Python Wrapper.
python = subprocess.Popen(,
stdout=subprocess.PIPE,...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |