Code Comments
Programming Forum and web based access to our favorite programming groups.If I want to know if a process is currently running such as user1 1729 1 0 14:58:13 ? 0:00 start What command do I use to look for it? I know I could do a Unix ps and = grep for the process name and then awk it down but it seems that there = has got to be a way in Perl to do this. I been through the Camel and = Ram books and I can find all sorts of stuff about creating processes but = I guess I am just missing the part about testing to see if a process is = running. Rob Witzke The Public Library of Cincinnati rob.witzke@cincinnatilibrary.org
Post Follow-up to this message> If I want to know if a process is currently running such as > > user1 1729 1 0 14:58:13 ? 0:00 start > > What command do I use to look for it? I know I could do a Unix ps and grep for the process name and then awk it down but it seems that there has got to be a way in Perl to do this. I been through the Camel and Ram books and I can find all sorts of stuff about creating processes but I guess I am just missing the part about testing to see if a process is running. > > Rob Witzke > The Public Library of Cincinnati > rob.witzke@cincinnatilibrary.org > Generally you can't, mostly because systems vary a lot when it comes to such things as process wrangling, etc. More specifically your best options are to check the process table, either using Proc::ProcessTable or with the method you describe, or by having the running process store a 'pid' file, which is the normal *nix way. Long running services will generally store the process ID to a file on the system, then other processes that need to check it or send it signals will read that pid for the information, if you have control over the subprocess you want to check you should have it do this. HTH, http://danconia.org
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.