开发者

how to check if ruby script is running in background from PHP script?

开发者 https://www.devze.com 2022-12-09 06:01 出处:网络
say a ruby script is running ruby.rb SOMEUSERID using PHP, how can i find out whether something exactly like that is currently running or not ? Currently i am using PID to check but im not sure if t

say a ruby script is running

ruby.rb SOMEUSERID

using PHP, how can i find out whether something exactly like that is currently running or not ? Currently i am using PID to check but im not sure if this is efficient. What if there are lot of users running the ruby script, and the ruby script unexpectedly closes. The php script now looks for this PID, and then it turns out it's somebody else's ruby script....开发者_JAVA技巧trouble ensues.


I don't like the idea but you can do this on linux

exec('ps -A | grep ruby.rb', $output);

not sure what's about other systems.


Parse output from 'ps ax' perhaps

0

精彩评论

暂无评论...
验证码 换一张
取 消