Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Getting correct port number from process id Post 303042845 by sravani25 on Wednesday 8th of January 2020 11:04:38 AM
Old 01-08-2020
Getting correct port number from process id

Hi All,


i am trying to find the Jobss port number(either default port number or any other port number assigned) from the running process id.


But it's giving me multiple port numbers when searching with netstat command. Can someone help me in finding the correct port number from the process id.


Below is the process id for Jboss :


Code:
# ps -ef |grep jboss
root      2045  2001 18 15:49 pts/0    00:00:07 /opt/jdk1.8.0_161/bin/java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/opt/wildfly/standalone/log/server.log -Dlogging.configuration=file:/opt/wildfly/standalone/configuration/logging.properties -jar /opt/wildfly/jboss-modules.jar -mp /opt/wildfly/modules org.jboss.as.standalone -Djboss.home.dir=/opt/wildfly -Djboss.server.base.dir=/opt/wildfly/standalone



Code:
# netstat -anlp |grep 2045
tcp        0      0 0.0.0.0:9990            0.0.0.0:*               LISTEN      2045/java
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      2045/java
unix  2      [ ]         STREAM     CONNECTED     43013    2045/java
unix  2      [ ]         STREAM     CONNECTED     43029    2045/java




can someone help in finding the correct port number from the process id.
Moderator's Comments:
Mod Comment
Please use code tags.

Last edited by Peasant; 01-08-2020 at 12:23 PM.. Reason: Added tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

checking invoice number not correct

hello, I have the following script to check the invoice number is in order or not. However, it cannot show out the correct information. My expect output show below and I would like to only list out the NOT IN SEQUENCE inovice number (not included "ok") #!/bin/sh start=1 for file_number in... (8 Replies)
Discussion started by: happyv
8 Replies

2. UNIX for Dummies Questions & Answers

How to find the port number of the oracle process

Hi Unix Gurus, Can we find out the port number used by the oracle process is running.I tried to search the forum but coudnt find. Can anyone help me out with the command (2 Replies)
Discussion started by: thana
2 Replies

3. UNIX for Dummies Questions & Answers

Find what process on port number

Hi, I am on a Sun Solaris and I want to find out which process is allocated on a certain port. How can I do that? BR Andreas (4 Replies)
Discussion started by: mr_andrew
4 Replies

4. Shell Programming and Scripting

Find port number being used by a given process id

Unix gurus, I have a requirement wherein I want to find the port number for a given process id. Is it possible? If so how? TIA, Regards, Praveen (3 Replies)
Discussion started by: sunpraveen
3 Replies

5. Programming

Problem in getting the correct number from the string.

I have string named texts which consist of section label “BOOK-SEC-“. Section starts from 1 to n, where n is a number. For this example conside the value of n is 9. That is, the string variable looks like “BOOK-SEC-1... (2 Replies)
Discussion started by: SamRoj
2 Replies

6. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

7. Shell Programming and Scripting

What is the correct way to process files

Is there a general way I can use so as to process paths/files from your terminal without the need to backslash things? Till recently I used to use touch "file_here" but it does not work if file_here contains any of the characters ` and ", I still need to backslash them if I want to make the... (1 Reply)
Discussion started by: hakermania
1 Replies

8. Solaris

To get process id for port number

Hi All, How to get the list of port numbers and it is correspoding proceses id that are currently running on. Please suggest and it is urgent Thanks. (7 Replies)
Discussion started by: rbalaj16
7 Replies

9. IP Networking

Tcp ip port open but no such process (merged: Release A Port)

i want to kill a tcp connection by killing its pid with netstat -an i got the tcp ip connection on port 5914 but when i type ps -a or ps-e there is not such process running on port 5914 is it possible that because i do not log on with proper user account i can not see that process running? (30 Replies)
Discussion started by: alinamadchian
30 Replies

10. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies
rmid(1) 						      General Commands Manual							   rmid(1)

NAME
rmid - RMI activation system daemon SYNOPSIS
rmid [ options ] DESCRIPTION
The rmid tool starts the activation system daemon. Before activatable objects can be either registered with the activation system or acti- vated in a Java VM, the activation system daemon must be started. See the RMI Specification and Activation Tutorials for details on how to write programs that use activatable remote objects. The daemon can be started by executing the rmid command, and specifying a security policy file, as follows: example% rmid -J-Djava.security.policy=rmid.policy Note: When running Sun's implementation of rmid, by default you will need to specify a security policy file so that rmid can verify whether or not the information in each ActivationGroupDesc is allowed to be used to launch a JVM for an activation group. Specifically, the com- mand and options specified by the CommandEnvironment and any Properties passed to an ActivationGroupDesc's constructor must now be explic- itly allowed in the security policy file for rmid. The value of the sun.rmi.activation.execPolicy property dictates the policy that rmid uses to determine whether or not the information in an ActivationGroupDesc may be used to launch a JVM for an activation group. Executing rmid by default o starts the Activator and an internal registry on the default port, 1098, and o binds an ActivationSystem to the name java.rmi.activation.ActivationSystem in this internal registry. To specify an alternate port for the registry, you must specify the -port option when starting up rmid. For example, rmid -J-Djava.security.policy=rmid.policy -port 1099 starts the activation system daemon and a registry on the registry's default port, 1099. Starting rmid from inetd/xinetd An alternative to starting rmid from the command line is to configure inetd (Solaris) or xinetd (Linux) to start rmid on demand. When rmid starts up, it attempts to obtain an inherited channel (inherited from inetd/xinetd) by invoking the System.inheritedChannel method. If the inherited channel is null, then rmid was started from the command line, and it starts up as described above. If the inherited channel is not an instance of java.io.channels.ServerSocketChannel, rmid exits. If the inherited channel is a ServerSocketChannel instance, then rmid uses the java.net.ServerSocket obtained from the ServerSocketChannel as the server socket that accepts requests for the remote objects it exports, namely the registry in which the java.rmi.activation.Activa- tionSystem is bound and the java.rmi.activation.Activator remote object. The rmid tool, when started from inetd/xinetd, behaves the same as when it is started from the command line, except: o Output printed to System.err is redirected to a file. This file is located in the directory specified by the java.io.tmpdir system property (typically /var/tmp or /tmp) with the prefix "rmid-err" and the suffix "tmp". o The -port option is disallowed. If this option is specified, rmid will exit with an error message. o The -log option is required. If this option is not specified, rmid will exit with an error message. See the man pages for inetd (Solaris) or xinetd (Linux) for details on how to configure services to be started on demand. OPTIONS
-CsomeCommandLineOption Specifies an option that is passed as a command-line argument to each child process (activation group) of rmid when that process is created. For example, you could pass a property to each Java virtual machine spawned by the activation system daemon: rmid -C-Dsome.property=value This ability to pass command-line arguments o child processes can be useful for debugging. For example, the following command: rmid -C-Djava.rmi.server.logCalls=true will enable server-call logging in all child JVMs. -JsomeCommandLineOption Specifies an option that is passed to the java interpreter running rmid. For example, to specify that rmid use a policy file named rmid.policy, the -J option can be used to define the java.security.policy property on rmid's command line. For example: rmid -J-Djava.security.policy=rmid.policy -J-Dsun.rmi.activation.execPolicy=policy Specifies the policy that rmid employs to check commands and command-line options used to launch the JVM in which an activation group runs. Please note that this option exists only in Sun's implementation of the RMI activation daemon. If this property is not specified on the command line, the result is the same as if -J-Dsun.rmi.activation.execPolicy=default were specified. The possible values of policy can be default, policyClassName, or none: o default (or if this property is unspecified) The default execPolicy allows rmid to execute commands with specific command-line options only if rmid has been granted permission to execute those commands and options in the security policy file that rmid uses. Only the default activation group implementation can be used with the default execution policy. rmid launches a JVM for an activation group using the information in the group's registered activation group descriptor, an Acti- vationGroupDesc. The group descriptor specifies an optional ActivationGroupDesc.CommandEnvironment which includes the command to execute to start the activation group as well as any command line options to be added to the command line. By default, rmid uses the java command found in java.home. The group descriptor also contains properties overrides that are added to the command line as options defined as: -Dproperty=value The permission com.sun.rmi.rmid.ExecPermission is used to grant rmid permission to execute a command, specified in the group descriptor's CommandEnvironment to launch an activation group. The permission com.sun.rmi.rmid.ExecOptionPermission is used to allow rmid to use command-line options, specified as properties overrides in the group descriptor or as options in the CommandEn- vironment, when launching the activation group. When granting rmid permission to execute various commands and options, the permissions ExecPermission and ExecOptionPermission need to be granted universally (that is, granted to all code sources). ExecPermission The ExecPermission class represents permission for rmid to execute a specific command to launch an activation group. Syntax The name of an ExecPermission is the path name of a command to grant rmid permission to execute. A path name that ends in "/*" indicates all the files contained in that directory (where "/" is the file-separator character, File.separatorChar). A path name that ends with "/-" indicates all files and subdirectories contained in that directory (recursively). A path name consisting of the special token "<<ALL FILES>>" matches any file. Note: A path name consisting of a single "*" indicates all the files in the current directory, while a path name consisting of a single "-" indicates all the files in the current directory and (recursively) all files and subdirectories contained in the current directory. ExecOptionPermission The ExecOptionPermission class represents permission for rmid to use a specific command-line option when launching an acti- vation group. The name of an ExecOptionPermission is the value of a command line option. Syntax Options support a limited wildcard scheme. An asterisk signifies a wildcard match, and it may appear as the option name itself (that is, it matches any option), or an asterisk may appear at the end of the option name only if the asterisk fol- lows either a "." or "=". For example: "*" or "-Dfoo.*" or "-Da.b.c=*" is valid; "*foo" or "-Da*b" or "ab*" is not. Policy file for rmid When granting rmid permission to execute various commands and options, the permissions ExecPermission and ExecOptionPermission need to be granted universally (that is, granted to all code sources). It is safe to grant these permissions universally because only rmid checks these permissions. An example policy file that grants various execute permissions to rmid is: grant { permission com.sun.rmi.rmid.ExecPermission "/files/apps/java/jdk1.2.2/bin/java"; permission com.sun.rmi.rmid.ExecPermission "/files/apps/rmidcmds/*"; permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=/files/policies/group.policy"; permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.debug=*"; permission com.sun.rmi.rmid.ExecOptionPermission "-Dsun.rmi.*"; }; The first permission granted allow rmid to execute the 1.2.2 version of the java command, specified by its explicit path names. Note that by default, the version of the java command found in java.home is used (the same one that rmid uses), and does not need to be specified in the policy file. The third permission allows rmid to execute any command in the directory /files/apps/rmid- cmds. The fourth permission granted, an ExecOptionPermission, allows rmid to launch an activation group that defines the security policy file to be /files/policies/group.policy. The next permission allows the java.security.debug property to be used by an activation group. The last permission allows any property in the sun.rmi property name hierarchy to be used by activation groups. To start rmid with a policy file, the java.security.policy property needs to be specified on rmid's command line. For example: rmid -J-Djava.security.policy=rmid.policy o policyClassName If the default behavior is not flexible enough, an administrator can provide, when starting rmid, the name of a class whose check- ExecCommand method is executed in order to check commands to be executed by rmid. The policyClassName specifies a public class with a public, no-argument constructor and an implementation of the following check- ExecCommand method: public void checkExecCommand(ActivationGroupDesc desc, String[] command) throws SecurityException; Before launching an activation group, rmid calls the policy's checkExecCommand method, passing it the activation group descriptor and an array containing the complete command to launch the activation group. If the checkExecCommand throws a SecurityException, rmid will not launch the activation group and an ActivationException will be thrown to the caller attempting to activate the object. o none If the sun.rmi.activation.execPolicy property value is "none", then rmid will not perform any validation of commands to launch activation groups. -log dir Specifies the name of the directory the activation system daemon uses to write its database and associated information. The log directory defaults to creating a directory, log, in the directory in which the rmid command was executed. -port port Specifies the port rmid's registry uses. The activation system daemon binds the ActivationSystem, with the name java.rmi.activa- tion.ActivationSystem, in this registry. Thus, the ActivationSystem on the local machine can be obtained using the following Nam- ing.lookup method call: import java.rmi.*; import java.rmi.activation.*; ActivationSystem system; system = (ActivationSystem) Naming.lookup("//:port/java.rmi.activation.ActivationSystem"); -stop Stops the current invocation of rmid, for a port specified by the -port option. If no port is specified, it will stop the rmid run- ning on port 1098. ENVIRONMENT VARIABLES
CLASSPATH Used to provide the system a path to user-defined classes. Directories are separated by colons. For example, example% .:/usr/local/java/classes SEE ALSO
rmic(1) See (or search java.sun.com) for the following: RMI Specification @ http://java.sun.com/j2se/1.5/docs/guide/rmi/spec/rmiTOC.doc.html 10 March 2001 rmid(1)
All times are GMT -4. The time now is 08:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy