powerhouse has asked for the wisdom of the Perl Monks concerning the following question:

Does Perl have a way to check the account and see how many people are accessing the same script running, or one other Perl script? Like in the PID processes? I have search for fork and other things, but cannot quite find my answer. I would appreciate it if you know it can and know of a resource I can read up on it, I'd love the link, or if you know of a simple module that does it, or code, I'd appreciate anything you can help me with.

thx,
Richard

Replies are listed 'Best First'.
Re: Other Script Processes
by tuxz0r (Pilgrim) on Nov 17, 2007 at 01:57 UTC
    Are you wanting to see how many "different" people are running a particular script? This can be done by looking through the running processes (ps) and getting the unique users running the script (you could write a nice perl script to do this). If, that is what you are talking about. A little more clarification could help.

    ---
    echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'
    Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.

      Yes, I need to know how many different people are on our website. We just launched this program and already have over 10k members, so the problem is that there are people on this website all the time.

      Therefore If I make a change to the core files, and someone is loading the file they get an error. I want to minimize that so it would be very helpful if I can figure out how many people are on the main scripts which there are two of them the index.cgi script and the members.cgi script, both of them load the same core files. So if I can figure out how many different people are on them I can try to upload the files when there are none, or just a few. I can pass a message to all visitors that says "we are updating a core file if you get an error please wait 2 minutes and try again. sorry for the inconvenience... blah blah... whatever..." Anyhow, I try to keep each file a small file, like 2k lines or less, then I just pull each file in from the main core file. That way when I upload it uploads really fast, so it does not cause much interuption.

      I appreciate everything.
      thx,
      Richard

        If I'm not mistaken, rename is atomic on unix, so instead of copying your new file over the old one, move it over.

        For example, upload the new index.cgi as index.cgi.new, then issue mv index.cgi.new index.cgi.

Re: Other Script Processes
by TOD (Friar) on Nov 17, 2007 at 03:15 UTC
    there already exist tools like webalizer or awstats, which might fulfill your wishes.

    --------------------------------
    masses are the opiate for religion.