/    Sign up×
Community /Pin to ProfileBookmark

I am on a Mac OS X server and I am trying to one of two things… if I can get either one to work I’d be happy.

First, I’m trying to do a system call to get the running processes. Doing a “ps -cx” in PHP give me a different set of processes than when I type it into the terminal window. I need the set that is returned in the terminal window. I also need to redirect it into a file so I can see if the process I want is running since I don’t think I can check the output of the system call in the PHP script.

Second, if I can’t get the proper set of processes back using a php system call I can run a simple C program that can do it, but I can’t seem to call the C program from PHP.

Here is the code I’ve testing with :

[code]
system(“ps -cx”); echo “<br>”;
system(“ps -cx > SystemCheckFile.txt”);
system(/User/administrator/C Apps/SystemCall/SystemCall”);
[/code]

The first one echos out the processes but all I get back is a series of httpd processes.

The second one is supposed to redirect the output to the fiel SystemCheckFile.txt, but I can’t find it anywhere on my computer which leads me to believe that the file is not getting creatied.

The third one calls a C program that does the same thing as the second call except when I run the program on it’s own, I get all the processes that I am expecting, such as Netscape, Finder, Dreamweaver..etc…

If anyone has a suggestion, I am willing to listen ?

  • sharyn
  • to post a comment
    PHP

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @sharynauthorOct 27.2004 — Solution :

    <i>
    </i>do {
    $PNG_running = system("ps -acux | grep PNG");
    } while (strlen($PNG-running) &gt; 0)


    when the PNG process stops running, I can display my PNG file ?
    ×

    Success!

    Help @sharyn spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.10,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...