且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查rpc应用程序是否在linux系统中运行

更新时间:2022-06-22 02:48:28

你好,



如果查看Process类的MSDN文档,你会发现支持GetProcessByName仅适用于以下平台。

Hello,

If you look at MSDN documentation for Process class you will realize that the GetProcessByName is supported for following platforms only.
Windows 8,Windows Server 2012,Windows 7,Windows Vista SP2,Windows Server 2008(不支持服务器核心角色),Windows Server 2008 R2(支持服务器核心角色) SP1或更高版本;不支持Itanium)
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

对于Unix / Linux,您可以使用SSH然后使用

For Unix/Linux you can use SSH and then use

ps -Af | grep "YOUR PROCESS NAME"

此命令返回的输出很容易。典型输出如下所示。

The output returned by this command is easily. The typical output is shown below.

UID        PID  PPID  C STIME TTY          TIME CMD
hope     29197 18961  0 Sep27 ?        00:00:06 sshd: hope@pts/87
hope     32097 29197  0 Sep27 pts/87   00:00:00 -csh
hope     7209  32097  0 12:17 pts/87   00:00:00 ps -Af
mysql    18617 18581  0 Jan10 ?        05:36:19 /usr/libexec/mysqld --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=my



您可以使用SharpSSH [为此目的^ ]库。



问候,


You can use SharpSSH[^] library for this purpose.

Regards,