PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 27th, 2004, 03:05 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
system call

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");
  


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

Reply With Quote
  #2  
Old October 27th, 2004, 04:33 PM
sharyn sharyn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 32 sharyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 53 m 17 sec
Reputation Power: 5
Talking * Solved *

Solution :

Code:
 do {
   $PNG_running = system("ps -acux | grep PNG");
 } while (strlen($PNG-running) > 0)
 


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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > system call


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT