检查服务器上是否正在运行某项服务 [英] Check if a certain service is running on the server

查看:96
本文介绍了检查服务器上是否正在运行某项服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。


我需要知道我的服务器上是否有服务正在运行。有没有PHP

指令可以用来做这个?

解决方案

Shadlan schreef:
< blockquote class =post_quotes>
嗨。


我需要知道我的服务器上是否有服务正在运行。有没有PHP

指令可以用来做这个?



嗨Shadlan,


如果你的意思是服务流程:是的。

例如,对于* nix:

exec(" ps -aux");


在这里看看exec-zoo:
< a rel =nofollowhref =http://nl3.php.net/manual/en/book.exec.phptarget =_ blank> http://nl3.php.net/manual/en/book .exec.php


如果你在W


机器上,你可以通过相同的命令行指令

方式。


所以一旦你知道你会在命令提示上做什么来获得答案

你的问题,你可以将该命令传递给PHP中的一个exec函数

并获得结果。

http://nl3.php.net/manual/en/function.passthru.php


问候,

Erwin Moller


-

构建软件设计有两种方法:一种方法是

使它变得如此简单以至于显然没有任何缺陷,而另一种方式是使它变得如此复杂以至于没有明显的
缺陷。第一种方法要困难得多。

- C.A.R. Hoare


10月22日,11:34 * am,Shadlan< shad ... @ arjoc.comwrote:


嗨。


我需要知道我的服务器上是否有服务正在运行。有没有PHP

指令可以用来做这个?



我不知道你的意思是1.你的服务器上安装了一些php服务(程序)

,如果启用了,或者如果2.网页中有一些要求

的程序正在运行,以便在网页上执行

所需的操作。


如果你的意思是1.有一个非常简单的php函数会告诉你

很多关于你的php(如果安装的话)会做什么。一个简单的单行网页

页面就可以了。请参阅我的服务器上的工作原理
http:// www。 cwdjr.net/php/phpInfo.php 。您需要做的就是写一个简单的.php页面,其中包含<?php phpinfo(); ?>" (不用

报价)在一行上。


如果你的意思是2.,过程程序可以用一些值写成

例如测试设置为0.对于

过程的程序的第一步是重置测试说1.该过程应以

设置结束然后通过检查测试值来检查过程是否正在运行



Hi.

I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?

解决方案

Shadlan schreef:

Hi.

I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?

Hi Shadlan,

If you mean by a service a process: yes.
eg for *nix:
exec("ps -aux");

Have a look at the exec-zoo here:
http://nl3.php.net/manual/en/book.exec.php

If you are on W


machine, you can pass commandline instructions the same
way.

So once you know WHAT you would do on the commandprompt to get an answer
to your question, you can pass that command to one of the exec function
in PHP and get the result.

http://nl3.php.net/manual/en/function.passthru.php

Regards,
Erwin Moller

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare


On Oct 22, 11:34*am, Shadlan <shad...@arjoc.comwrote:

Hi.

I need to know if a service is running on my server. Is there any PHP
instruction that I can use to do this?

I can not tell if you mean 1. some php service(program) is installed
on your server and if it is enabled, or if 2. some program called for
in a web page is running at the moment to do something required for
the web page.

If you mean 1. there is a very simple php function that will tell you
much about what your php, if installed, will do. A simple one line web
page is all it takes. See how it works on my server at
http://www.cwdjr.net/php/phpInfo.php . All you need to do is to write
a simple .php page that contains "<?php phpinfo(); ?>" (without
quotes) on one line.

If you mean 2., the process program can be written with some value
such as test set to say 0. The very first step in the program for the
process would be to reset test to say 1. The process should end with
setting test back to 0. You can then check if the process is running
or not by examination of the value of test.


这篇关于检查服务器上是否正在运行某项服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆