Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to verify whether there are multiple processes calling the same job in php

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to verify whether multiple processes call the same job in php". In daily operations, I believe many people have doubts about how to verify whether there are multiple processes calling the same job in php. Xiaobian consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful to answer the doubts of "how to verify whether multiple processes call the same job in php". Next, please follow the editor to study!

When using a scheduled task, the company once ran two processes running the same scheduled task, resulting in many job executing twice. In order to prevent this situation, you need to make a limit on the process of linux. At the same time, if a process is calling this scheduled task, then another process is not allowed to call again. Here is the specific code.

/ / $pro method name private function _ verifyPsAux ($pro) {$arrProcess = array ($pro = > "/ usr/local/www/scrm/public/index.php / records/job/ {$pro}"); $pidNumber = 0; foreach ($arrProcess as $key = > $value) {exec ("ps aux | grep'$key'", $return); $isRunning = false; / / instruction not executed foreach ($return as $k = > $v) {if (! Strrpos ($v, $value) continue; / / preg_match ('/\ dsongs:\ d + +\ / usr/iu', $v, $match); / / if (! Isset ($match [0]) continue; $isRunning = true; $pidNumber++;} / / if the current process exists, terminate if ($isRunning & & $pidNumber > 1) {echo'[_'. Date ('Y-m-d Hrigi'). "_] the process is executing\ r\ n"; exit ();}. At this point, the study on "how to verify whether multiple processes call the same job in php" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

  • How to realize the top navigation bar and side navigation bar of AmazeUI in html5

    This article mainly introduces how to realize the top navigation bar and side navigation bar of AmazeUI in html5. The article is very detailed and has certain reference value. Friends who are interested must read it! First, the code for the top navigation bar:

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report