`

如何知道当前有多少个用户正在使用你的web项目

阅读更多

1.查找指定目标进程(java的atf web工程)
  ps -aux | grep atf
 root      3582  0.1 11.2 382228 190588 ?       Sl   09:31   0:19 java -Datf -jar start.jar etc/jetty.xml
 root     22121  0.0  0.0   1644   508 pts/1    R+   12:12   0:00 grep atf


2.在全部端口中查找进程号为 pid=3582(atf项目的进程号) 的信息
2. netstat -naop | grep 3582
 tcp6       0      0 :::8080                 :::*                    LISTEN     3582/java           off (0.00/0/0)
 tcp6       0      0 :::8443                 :::*                    LISTEN     3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.:49454 ::ffff:192.168.6.1:1531 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.:49593 ::ffff:192.168.6.:61616 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.:34871 ::ffff:192.168.6.1:1531 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3692 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3689 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3695 ESTABLISHED3582/java           off (0.00/0/0)
 tcp6       0      0 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3697 ESTABLISHED3582/java           off (0.00/0/0)


其中 :::8080 和:::8443  是 atf项目打开的端口号,
其他是已经和atf建立连接的请求服务。
这里建立的7个链接
两个oracle的连接   
 ::ffff:192.168.6.:49454 ::ffff:192.168.6.1:1531 ESTABLISHED
 ::ffff:192.168.6.:34871 ::ffff:192.168.6.1:1531 ESTABLISHED
一个apache-activemq的连接
        ::ffff:192.168.6.:49593 ::ffff:192.168.6.:61616
四个请求连接(表示有两个用户在使用atf系统系统,在生产环境中可以用来判断当前正在使用atf系统的用户数)
 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3692 ESTABLISHED3582/java           off (0.00/0/0)
 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3689 ESTABLISHED3582/java           off (0.00/0/0)
 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3695 ESTABLISHED3582/java           off (0.00/0/0)
 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3697 ESTABLISHED3582/java           off (0.00/0/0)


netstat在显示连接情景是的state的几个值所代表的意义,其实也就是TCP连接的三次握手细分的状态:
The state of the socket. Since there are no states in raw mode and usually no states used in UDP, this  column  may  be
       left blank. Normally this can be one of several values:

ESTABLISHED   #套结字确立连接
              The socket has an established connection.

SYN_SENT    
       The socket is actively attempting to establish a connection.

SYN_RECV
           A connection request has been received from the network.

 FIN_WAIT1
       The socket is closed, and the connection is shutting down.

 FIN_WAIT2
       Connection is closed, and the socket is waiting for a shutdown from the remote end.

TIME_WAIT
              The socket is waiting after close to handle packets still in the network.

  CLOSED The socket is not being used.

 CLOSE_WAIT
      The remote end has shut down, waiting for the socket to close.

 LAST_ACK
              The remote end has shut down, and the socket is closed. Waiting for acknowledgement.

    LISTEN
he  socket is listening for incoming connections.  Such sockets are not included in the output unless you spec-
              ify the --listening (-l) or --all (-a) option.

  CLOSING
        Both sockets are shut down but we still don’t have all our data sent.
  UNKNOWN
              The state of the socket is unknown.

 

  

WINDOWS自带的无敌kill进程命令
问:怎么才能关掉一个用任务管理器关不了的进程?我前段时间发现我的机子里多了一个进程,只要开机就在,我用任务管理器却怎么关也关不了

答1:杀进程很容易,随便找个工具都行。比如IceSword。关键是找到这个进程的启动方式,不然下次重启它又出来了。顺便教大家一招狠的。其实用Windows自带的工具就能杀大部分进程:

  c:>ntsd -c q -p PID

  只有System、SMSS.EXE和CSRSS.EXE不能杀。前两个是纯内核态的,最后那个是Win32子系统,ntsd本身需要它。ntsd从2000开始就是系统自带的用户态调试工具。被调试器附着(attach)的进程会随调试器一起退出,所以可以用来在命令行下终止进程。使用ntsd自动就获得了debug权限,从而能杀掉大部分的进程。ntsd会新开一个调试窗口,本来在纯命令行下无法控制,但如果只是简单的命令,比如退出(q),用-c参数从命令行传递就行了。NtsdNtsd 按照惯例也向软件开发人员提供。只有系统开发人员使用此命令。有关详细信息,请参阅 NTSD 中所附的帮助文件。用法:开个cmd.exe窗口,输入:

  ntsd -c q -p PID

  把最后那个PID,改成你要终止的进程的ID。如果你不知道进程的ID,任务管理器->进程选项卡->查看->选择列->勾上"PID(进程标识符)",然后就能看见了。

答2:xp下还有两个好东东tasklist和tskill。tasklist能列出所有的进程,和相应的信息。tskill能查杀进程,语法很简单:tskill 程序名!!


附:NTSD 中所附的帮助文件

usage: ntsd [-?] [-2] [-d] [-g] [-G] [-myob] [-lines] [-n] [-o] [-s] [-v] [-w]
[-r BreakErrorLevel] [-t PrintErrorLevel]
[-hd] [-pd] [-pe] [-pt #] [-pv] [-x | -x{e|d|n|i} ]
[-- | -p pid | -pn name | command-line | -z CrashDmpFile]
[-zp CrashPageFile] [-premote transport] [-robp]
[-aDllName] [-c "command"] [-i ImagePath] [-y SymbolsPath]
[-clines #] [-srcpath SourcePath] [-QR machine] [-wake ]
[-remote transport:server=name,portid] [-server transport:portid]
[-ses] [-sfce] [-sicv] [-snul] [-noio] [-failinc] [-noshell]

where: -? displays this help text
command-line is the command to run under the debugger
-- is the same as -G -g -o -p -1 -d -pd
-aDllName sets the default extension DLL
-c executes the following debugger command
-clines number of lines of output history retrieved by a remote client
-failinc causes incomplete symbol and module loads to fail
-d sends all debugger output to kernel debugger via DbgPrint
-d cannot be used with debugger remoting
-d can only be used when the kernel debugger is enabled
-g ignores initial breakpoint in debuggee
-G ignores final breakpoint at process termination
-hd specifies that the debug heap should not be used
for created processes. This only works on Windows Whistler.
-o debugs all processes launched by debuggee
-p pid specifies the decimal process Id to attach to
-pd specifies that the debugger should automatically detach
-pe specifies that any attach should be to an existing debug port
-pn name specifies the name of the process to attach to
-pt # specifies the interrupt timeout
-pv specifies that any attach should be noninvasive
-r specifies the (0-3) error level to break on (SeeSetErrorLevel)
-robp allows breakpoints to be set in read-only memory
-t specifies the (0-3) error level to display (SeeSetErrorLevel)
-w specifies to debug 16 bit applications in a separate VDM
-x sets second-chance break on AV exceptions
-x{e|d|n|i} sets the break status for the specified event
-2 creates a separate console window for debuggee
-i ImagePath specifies the location of the executables that generated
the fault (see _NT_EXECUTABLE_IMAGE_PATH)
-lines requests that line number information be used if present
-myob ignores version mismatches in DBGHELP.DLL
-n enables verbose output from symbol handler
-noio disables all I/O for dedicated remoting servers
-noshell disables the .shell (!!) command
-QR <machine> queries for remote servers
-s disables lazy symbol loading
-ses enables strict symbol loading
-sfce fails critical errors encountered during file searching
-sicv ignores the CV record when symbol loading
-snul disables automatic symbol loading for unqualified names
-srcpath specifies the source search path
-v enables verbose output from debugger
-wake wakes up a sleeping debugger and exits
-y specifies the symbol search path (see _NT_SYMBOL_PATH)
-z specifies the name of a crash dump file to debug
-zp specifies the name of a page.dmp file
to use with a crash dump
-remote lets you connect to a debugger session started with -server
must be the first argument if present
transport: tcp | npipe | ssl | spipe | 1394 | com
name: machine name on which the debug server was created
portid: id of the port the debugger server was created on
for tcp use: port=
for npipe use: pipe=
for 1394 use: channel=
for com use: port=,baud=,
channel=
for ssl and spipe see the documentation
example: ... -remote npipe:server=yourmachine,pipe=foobar
-server creates a debugger session other people can connect to
must be the first argument if present
transport: tcp | npipe | ssl | spipe | 1394 | com
portid: id of the port remote users can connect to
for tcp use: port=
for npipe use: pipe=
for 1394 use: channel=
for com use: port=,baud=,
channel=
for ssl and spipe see the documentation
example: ... -server npipe:pipe=foobar
-premote transport specifies the process server to connect to
transport arguments are given as with remoting

Environment Variables:

_NT_SYMBOL_PATH=[Drive:][Path]
Specify symbol image path.

_NT_ALT_SYMBOL_PATH=[Drive:][Path]
Specify an alternate symbol image path.

_NT_DEBUGGER_EXTENSION_PATH=[Drive:][Path]
Specify a path which should be searched first for extensions dlls

_NT_EXECUTABLE_IMAGE_PATH=[Drive:][Path]
Specify executable image path.

_NT_SOURCE_PATH=[Drive:][Path]
Specify source file path.

_NT_DEBUG_LOG_FILE_OPEN=filename
If specified, all output will be written to this file from offset 0.

_NT_DEBUG_LOG_FILE_APPEND=filename
If specified, all output will be APPENDed to this file.

_NT_DEBUG_HISTORY_SIZE=size
Specifies the size of a server's output history in kilobytes

Control Keys:

Quit debugger
Break into Target
Force a break into debuggee (same as Ctrl-C)
Debug Current debugger
Toggle Verbose mode
Print version information
ntsd: exiting - press enter ---

 

 

 

==============================

liunx 下
1. 查找指定项目的进程PID
 ps -aux | grep atf
         root      3582  0.1 11.2 382228 190588 ?       Sl   09:31   0:19 java -Datf -jar start.jar etc/jetty.xml
         root     22121  0.0  0.0   1644   508 pts/1    R+   12:12   0:00 grep atf

2.在全部端口中查找进程号为 pid=3582(atf项目的进程号) 的信息
netstat -naop | grep 3582
         tcp6       0      0 :::8080                 :::*                    LISTEN     3582/java           off (0.00/0/0)
         tcp6       0      0 :::8443                 :::*                    LISTEN     3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.:49454 ::ffff:192.168.6.1:1531 ESTABLISHED3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.:49593 ::ffff:192.168.6.:61616 ESTABLISHED3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.:34871 ::ffff:192.168.6.1:1531 ESTABLISHED3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3692 ESTABLISHED3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3689 ESTABLISHED3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3695 ESTABLISHED3582/java           off (0.00/0/0)
         tcp6       0      0 ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3697 ESTABLISHED3582/java           off (0.00/0/0)

其中 :::8080 和:::8443  是 atf项目打开的端口号,
其他是已经和atf建立连接的请求服务。
这里建立的7个链接
两个oracle的连接   
         ::ffff:192.168.6.:49454 ::ffff:192.168.6.1:1531 ESTABLISHED
         ::ffff:192.168.6.:34871 ::ffff:192.168.6.1:1531 ESTABLISHED
一个apache-activemq的连接
        ::ffff:192.168.6.:49593 ::ffff:192.168.6.:61616
四个请求连接(表示有两个用户在使用atf系统系统,在生产环境中可以用来判断当前正在使用atf系统的用户数)
         ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3692 ESTABLISHED3582/java           off (0.00/0/0)
         ::ffff:192.168.6.2:8080 ::ffff:192.168.88.:3689 ESTABLISHED3582/java           off (0.00/0/0)
         ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3695 ESTABLISHED3582/java           off (0.00/0/0)
         ::ffff:192.168.6.2:8443 ::ffff:192.168.88.:3697 ESTABLISHED3582/java           off (0.00/0/0)

二、 windows 下
1.查找指定目标进程(java的atf web工程)
tasklist  -v |find "java"
图像名        PID 
javaw.exe     2760

2.在全部端口中查找进程号为 pid=3582(atf项目的进程号) 的信息
netstat -nao |find "2760"
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       1232
  TCP    0.0.0.0:8443           0.0.0.0:0              LISTENING       1232
  TCP    192.168.88.46:4168     192.168.6.19:1531      ESTABLISHED     1232
  TCP    192.168.88.46:4169     192.168.6.19:1531      ESTABLISHED     1232

 

 

分享到:
评论

相关推荐

    .NET6平台开发WebApi—使用JWT进行用户鉴权和测试源码

    1.用.Net6平台WebApi项目开发 2.使用jwt给用户颁发密钥 3.swagger验证配置 4.接口jwt验证密钥方法 5.运行就能使用

    基于spring的项目管理应用程序。projecty-web-rest-2.0 (1).zip

    我知道项目数据是非常敏感的,所以当你是它们的所有者时,你会感觉更好。 对于那些没有服务器的用户,Projecty将在托管服务器上完全免费。 任务: 任务管理(将任务标记为待办、进行中、已完成) 向用户分配任务 ...

    基于Java web的图书管理系统

    项目名称:基于Java web的图书管理系统(Library) 当前版本:V2.0.2版本 难度等级:✩✩  复杂程度:✩✩✩✩  用户类型:双角色(普通用户和管理员) 设计模式:MVC(jsp+servlet+javabean) 项目架构:B/S架构 ...

    本项目基于Spring平台,整合websocket协议,实现一个简易web聊天室的功能

    本项目基于Spring平台,整合websocket协议,实现一个简易web聊天室的功能。主要特性如下:包含聊天室登录、退出的功能。登录时,浏览器自动向服务器发起websocket连接,退出时自动切断。账号Jon或者TOM,密码是1234,...

    工程硕士学位论文 基于Android+HTML5的移动Web项目高效开发探究

    1.2.4 Android移动Web项目开发的三种解决方案:Native, Web和Hybrid优缺陷分析 4 1.2.5国内外应用现状 6 1.2.6 研究现状总结 7 1.3研究目标与内容 7 1.3.1多窗口浏览器模式的实现机制 7 1.3.2跨域交互即缓存处理方法...

    PHP和MySQL Web开发第4版pdf以及源码

    9.6 创建一个Web用户 9.7 使用正确的数据库 9.8 创建数据库表 9.8.1 理解其他关键字的意思 9.8.2 理解列的类型 9.8.3 用SHOW和DESCRIBE来查看数据库 9.8.4 创建索引 9.9 理解MySQL的标识符 9.10 选择列数据...

    最新ssm项目基于web的电影购票系统+vue.zip

    最新SSM项目基于Web的电影购票系统Vue.zip是为影院和电影...通过这些资料,用户可以了解到如何构建一个高效、现代化的基于Web的电影购票系统,并且可以作为一个实用的案例来学习Vue.js和SSM框架在实际应用中的使用。

    PHP和MySQL WEB开发(第4版)

    9.6 创建一个Web用户 9.7 使用正确的数据库 9.8 创建数据库表 9.8.1 理解其他关键字的意思 9.8.2 理解列的类型 9.8.3 用SHOW和DESCRIBE来查看数据库 9.8.4 创建索引 9.9 理解MySQL的标识符 9.10 选择列数据类型 ...

    最新ssm项目基于web办事大厅政务预约系统+vue.zip

    最新SSM项目基于Web的办事大厅政务预约系统Vue.zip...通过这些资料,用户可以了解到如何构建一个高效、现代化的基于Web的办事大厅政务预约系统,并且可以作为一个实用的案例来学习Vue.js和SSM框架在实际应用中的使用。

    project-web:大学项目

    借助这项服务,Google会定期将用户的当前位置存储在云中,以便用户可以查看他们的移动历史并建议靠近其位置的兴趣点。 Google为用户维护的项目只能自己访问。 用户可以通过访问网站并选择与“位置记录”服务关联的...

    PythonWeb开发基础教程-第5章-视图.pptx

    本章主要内容: 定义视图 处理请求和响应 在视图中使用模型 基于类的视图 PythonWeb开发基础教程-第5章-视图全文共40页,当前为第2页。 5.1 定义视图 Django的视图也可称为视图函数,即用Python函数来定义视图。...

    Lotus Domino WEB详细 学习笔记

    3. 判断当前用户是否是“某个组”的成员,然后来显示和隐藏 6 4. 在Lotus Domino 中显示图 6 5. 链接JS文件 6 6. 删除文档的方法 7 7. $$return 域的使用 8 8. 将表单设计为视图或导航器模板 9 9....

    PythonWeb开发基础教程-第9章-Python在线题库.pptx

    第9章 Python在线题库 本章主要内容: 项目设计 项目实现 数据管理 实现试卷导出 PythonWeb开发基础教程-第9章-Python在线题库全文共26页,当前为第2页。 9.1 项目设计 本节主要内容 功能分析 数据库设计 PythonWeb...

    Java Web应用开发:个人信息修改.docx

    如果已经登录,每个文本框中显示当前登录用户的各项信息,用户可以在文本框中修改。注意: (1)不显示用户id (2)用户名的文本框设置为只读(不允许修改用户名) (3)确认密码框为空 2 思路 (1) 用户成功登录后,...

    最新ssm项目基于web的物流配送管理系统的设计与实现+vue.zip

    最新SSM项目基于Web的物流配送管理系统的设计与实现Vue....通过这些资料,用户可以了解到如何构建一个高效、现代化的基于Web的物流配送管理系统,并且可以作为一个实用的案例来学习Vue.js和SSM框架在实际应用中的使用。

    PHP和MySQL Web开发第4版

    9.6 创建一个Web用户 9.7 使用正确的数据库 9.8 创建数据库表 9.8.1 理解其他关键字的意思 9.8.2 理解列的类型 9.8.3 用SHOW和DESCRIBE来查看数据库 9.8.4 创建索引 9.9 理解MySQL的标识符 9.10 选择列数据...

    java毕设课设基于web的停车管理系统项目源码+演示+数据库sql文件

    项目名称:基于Web的停车管理系统 功能描述: 1. 用户注册与登录: - 用户可以进行注册,填写相关信息并创建账户。 - 用户可以使用注册的账户进行登录系统。 2. 停车场管理: - 管理员可以添加、编辑和删除...

    基于Java web的党务管理系统(源码+数据库+war发行包).zip

    项目启动 :renren-web.war 将renren-web.war,放到Tomcat webapps目录下,启动tomcat. ...原因:角色有固定的角色id,如果删除了角色重新创建的话,系统中判断当前用户角色处,也许会出现问题。 如果必要需要删除

    Web电子表格EtherCalc.zip

    数据存在 Web 端,多个用户可编辑同一份表格,其他人的修改会即时反应在当前编辑界面中。采用 LiveScript 语言编写。 EtherCalc是自由軟體,可在 GNU/Linux、FreeBSD、Mac OS X 和 Windows 上運行。 請先下載並安裝...

    ITDB基于Web的办公环境IT资产设备管理信息系统v1.8

    ITDB 1.8 更新内容: 增加了当前折旧值计算查询 修正了一些插入项目报价问题 告知用户的翻译文件被复制 实验的进口商品 固定蒙面输入错误时,增加更多的续约 允许用户自定义上传文件类型 架模型不是强制性的 id为1...

Global site tag (gtag.js) - Google Analytics