检查php脚本是否仍在运行 [英] Check if a php script is still running

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

问题描述

我有一个脚本监听jabber服务器并相应地做出响应。虽然它不应该停止,昨晚它做到了。现在我想每分钟运行一次cron作业来检查脚本是否正在运行,如果没有,就启动它。

I have a script that listens to a jabber server and responds accordingly. Though it's not supposed to stop, last night it did. Now I want to run a cron job every minute to check if the script is running, and start it if not.

问题是,如何检查特定脚本仍在运行?

The question is, how do I check if a particular script is still running?

一些解决方案已发布 这里 ,但这些都是Linux的,而我正在寻找一个Windows解决方案。有任何想法吗?感谢。

Some solutions have been posted here, but those are all for Linux, while I am looking for a Windows solution. Any ideas please? Thanks.

推荐答案

一个快速和肮脏的解决方法可能是脚本更新数据库中的行,日期列设置为CURRENT_TIMESTAMP。让cron第二个脚本检查此行的时间戳是否是最近的。

A quick and dirty workaround could be for the script to update a row in a database with a date column set to CURRENT_TIMESTAMP. Have the cron second script check if the timestamp of this row is recent.

这篇关于检查php脚本是否仍在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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