Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Rsh does not close connection on exit Post 302888741 by rbatte1 on Monday 17th of February 2014 06:59:14 AM
Old 02-17-2014
[Solved] Rsh does not close connection on exit

Dear all,

We have a service that we start up remotely with rsh but unfortunately, the rsh never returns to the calling server. This seems to be because the processes of the service we've just started hold the port open.
Code:
RBATTE1 @ /home/RBATTE1>netstat -na|grep 49.51
tcp4       0      0  111.222.333.444.514       111.222.333.555.1022      CLOSE_WAIT
tcp        0      0  111.222.333.444.1023      111.222.333.555.1021      FIN_WAIT_2
tcp4       0      0  111.222.333.444.50465     111.222.333.555.2049      ESTABLISHED

RBATTE1 @ /home/RBATTE1>sudo lsof -i tcp:514
COMMAND    PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
inetd    32516 root    6u  IPv6 0x71967de4      0t0  TCP *:shell (LISTEN)
dsrvcmd  75188 root    0u  IPv6 0x726cede4    0t125  TCP myserver.mydomain:shell->caller.mydomain:1022 (CLOSE_WAIT)

RBATTE1 @ /home/RBATTE1>

When run locally on the command line, all is well with the simple script and I can log off the session without issue or other prompt. When called with rsh, the script called does complete (we have logging to show that), so I'm wondering how I can disinherit/detach the service processes started up.

Server where script will run is AIX 5.1 Smilie and the server calling is RHEL 6.3

Suggestions would be most welcome. Many thanks, in advance,
Robin
Liverpool/Blackburn
UK

---------- Post updated at 11:59 AM ---------- Previous update was at 11:21 AM ----------

Cancel that. I managed it with a nohup xxxxx & call to start the service inside the script.


All working, and I feel pretty daft Smilie




Robin Smilie

Last edited by rbatte1; 02-17-2014 at 07:28 AM..
 

10 More Discussions You Might Find Interesting

1. Solaris

rsh connection is very slow.....what to look for...???

Hi All, My rsh connecion is very slow, what should I look for...??? Note : I get the rsh connection, but it takes time. Thanks & Regards, jumadhiya. (3 Replies)
Discussion started by: jumadhiya
3 Replies

2. UNIX for Dummies Questions & Answers

ftp - Connection close

Hi Can someone help me what is the problem, when i try to login via ftp, though i entered the correct password, i got an error message Connection refused. please help. thanks (3 Replies)
Discussion started by: kaibiganmi
3 Replies

3. Shell Programming and Scripting

rsh connection problem

I am trying to connect to a remote server using rsh. first i have given the following command. $ rsh 242.13.45.54 -l now i got the following message "connect to address 242.13.45.54: Connection refused Trying krb4 rlogin... connect to address 242.13.45.54: Connection refused trying... (1 Reply)
Discussion started by: ravi raj kumar
1 Replies

4. Programming

close existing tcp connection in C

Hello. I would like to know how to close an existing tcp socket. I have read some stuff and learned how to create a socket and then close it but have not found anything about how to close an existing tcp socket created by another application. The situation is this: I have an ODBC server running and... (6 Replies)
Discussion started by: raidzero
6 Replies

5. Shell Programming and Scripting

How to close TELNET Connection

Hi, I have logged into a system using Telnet and iam unable to close the connection to connect to the next system using arrays. Iam getting error "Connection Timed Out" Iam using net::Telnet module. Please suggest.. (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

6. Shell Programming and Scripting

Usage of NOHUP - How to keep the child process running even if I close the Server connection

Hi. ! When I use the 'NOHUP' along with the '&', the process will be running in the background. Even when I attempt to close (Meaning 'EXIT') the session (say PUTTY in this case), it wont exit unless the process is completed. But, say when I forcefully terminate the session (SHUT DOWN the... (2 Replies)
Discussion started by: WinBarani
2 Replies

7. Solaris

many tcp connection in close-wait

Hi, I use solaris Unix . I find there is some problem in application and it generate many "close-wait" tcp connect and stay in the server . it is generate by process id 7740 root@XX # netstat -an | grep CLOSE_WAIT | wc -l 285 root@XX # netstat -an | grep CLOSE_WAIT 10.158.35.4.34805 ... (2 Replies)
Discussion started by: abcdef
2 Replies

8. Solaris

Ssh to Solaris 10 server - close connection

Can ssh to server. Asks for password. Then seems to time out and close the connection. Any ideas? ---------- Post updated at 09:30 AM ---------- Previous update was at 07:51 AM ---------- Here is output from ssh -vvv -l user <IPaddress> debug3: packet_send2: adding 64 (len 59 padlen 5... (4 Replies)
Discussion started by: psychocandy
4 Replies

9. UNIX for Dummies Questions & Answers

Remotely close & rerun SSH connection

I'm trying to remotely run an upgrade script (via SSH) that update the SSH script on several hosts, just need to add several flags for the ssh command to look like this: ssh -Nf -i id_logs -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5... (4 Replies)
Discussion started by: OdedOvdat
4 Replies

10. Shell Programming and Scripting

Terminal running bash/rsync script does not close with exit (MacOS High SIerra)

Hello, I am running a bash script to do an rsync back on a computer running MacOS High Sierra. This is the script I am using, #!/bin/bash # main backup location, trailing slash included backup_loc="/Volumes/Archive_Volume/00_macos_backup/" # generic backup function function backup {... (12 Replies)
Discussion started by: LMHmedchem
12 Replies
REDUCE(3PVM)							  PVM Version 3.4						      REDUCE(3PVM)

NAME
pvm_reduce - Performs a reduction operation over members of the specified group. SYNOPSIS
C int info = pvm_reduce( void (*func)(), void *data, int count, int datatype, int msgtag, char *group, int rootginst) Fortran call pvmfreduce(func, data, count, datatype, msgtag, group, rootginst, info) PARAMETERS
func Function which defines the operation performed on the global data. Predefined are PvmMax, PvmMin, PvmSum, and PvmProduct. Users can define their own function. SYNOPSIS for func C void func(int *datatype, void *x, void *y, int *num, int *info) Fortran call func(datatype, x, y, num, info) data Pointer to the starting address of an array of local values. On return, the data array on the root will be overwritten with the result of the reduce operation over the group. For the other (non-root) members of the group the values of the data array upon return from the reduce operation are not defined; the values may be different than those originally passed to pvm_reduce. count Integer specifying the number of elements of datatype in the data array. The value of count should agree between all members of the group. datatype Integer specifying the type of the entries in the data array. (See below for defined types.) msgtag Integer message tag supplied by the user. msgtag should be >= 0. It allows the user's program to distinguish between different kinds of messages. group Character string group name of an existing group. rootginst Integer instance number of group member who gets the result. info Integer status code returned by the routine. Values less than zero indicate an error. DESCRIPTION
pvm_reduce() performs global operations such as max, min, sum, or a user provided operation on the data provided by the members of a group. All group members call pvm_reduce with the same size local data array which may contain one or more entries. The root task is identified by its instance number in the group. The inner workings of the pvm_reduce call are implementation dependent; however, when the pvm_reduce call completes, the root's data array will be equal to the specified operation applied element-wise to the data arrays of all the group members. A broadcast by the root can be used if the other members of the group need the resultant value(s). PVM supplies the following predefined functions that can be specified in func. PvmMin PvmMax PvmSum PvmProduct PvmMax and PvmMin are implemented for all the datatypes listed below. For complex values the minimum [maximum] is that complex pair with the minimum [maximum] modulus. PvmSum and PvmProduct are implemented for all the datatypes listed below with the exception of PVM_BYTE and BYTE1. C and Fortran defined datatypes are: C datatypes FORTRAN datatypes ----------------------------------- PVM_BYTE BYTE1 PVM_SHORT INTEGER2 PVM_INT INTEGER4 PVM_FLOAT REAL4 PVM_CPLX COMPLEX8 PVM_DOUBLE REAL8 PVM_DCPLX COMPLEX16 PVM_LONG A user defined function may be used in func. The argument func is a function with four arguments. It is the base function used for the reduction operation. Both x and y are arrays of type specified by datatype with num entries. The arguments datatype and info are as spec- ified above. The arguments x and num correspond to data and count above. The argument y contains received values. Caveat: pvm_reduce() does not block, a call to pvm_barrier may be necessary. For example, an error may occur if a task calls pvm_reduce and then leaves the group before the root has completed its call to pvm_reduce. Similarly, an error may occur if a task joins the group after the root has issued its call to pvm_reduce. Synchronization of the tasks (such as a call to pvm_barrier) was not included within the pvm_reduce implementation since this overhead is unnecessary in many user codes (which may already synchronize the tasks for other pur- poses). The current algorithm is very simple and robust. A future implementation may make more efficient use of the architecture to allow greater parallelism. ILLUSTRATION
The following example illustrates a call to pvm_reduce. Suppose you have three group members (instance numbers 0, 1, 2) with an array called Idata with 5 values as specified: instance the 5 values in the integer array 0 1, 2, 3, 4, 5 1 10, 20, 30, 40, 50 2 100, 200, 300, 400, 500 And, suppose that a call to reduce (such as the ones following) are issued where the root is the group member with instance value of 1: C: root = 1; info = pvm_reduce(PvmSum, &Idata, 5, PVM_INT, msgtag, "worker", root); Fortran: root = 1 call pvmfreduce(PvmSum, Idata, 5, INTEGER4, msgtag, "worker", root, info) Then, upon completion of the reduce call, the following will result: instance the 5 values in the integer array 0 .... not defined....... 1 111, 222, 333, 444, 555 2 .... not defined ...... EXAMPLES
C: info = pvm_reduce(PvmMax, &myvals, 10, PVM_FLOAT, msgtag, "worker", rootginst); Fortran: CALL PVMFREDUCE(PvmMax, MYVALS, COUNT, REAL4, & MTAG, 'worker', ROOT, INFO) ERRORS
These error conditions can be returned by pvm_reduce PvmNoInst Calling task is not in the group PvmBadParam The datatype specified is not appropriate for the specified reduction function. PvmSysErr Pvm system error SEE ALSO
pvm_bcast(3PVM), pvm_barrier(3PVM), pvm_psend(3PVM) 6 February, 1995 REDUCE(3PVM)
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy