Finding apache process id that is spawned by a wget


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Finding apache process id that is spawned by a wget
# 1  
Old 04-08-2010
Finding apache process id that is spawned by a wget

Hi,

I have a situation where I am writing a programme that runs a series of long running PHP scripts that can take anything from 20 minutes to 10 hours to execute.

I have a solution half implemented where I use via php exec(wget <location to command>) and get the process id back.

This returns to PHP the process ID of the wget process. However what I'm looking for is to get the process ID of the apache process that wget starts and runs. However the apache process that is doing the work doesn't appear to be any relation to the wget process (eg the apache process isn't a child process of wget).

What my question is - is there a way of determing the process Id of the apache process to send back to my php script for monitoring it ?

Cheers.

-mrploddy
# 2  
Old 04-08-2010
Quote:
Originally Posted by mrploddy
This returns to PHP the process ID of the wget process. However what I'm looking for is to get the process ID of the apache process that wget starts and runs. However the apache process that is doing the work doesn't appear to be any relation to the wget process (eg the apache process isn't a child process of wget).
They are connected by nothing but a network socket and have nothing in common otherwise. Think about it -- plug a different URL into wget and the process you spawn could be a thousand miles away! Smilie

If you want to spawn a local process, spawn a local process -- run the script yourself instead of wget-ing a URL that causes the web server to do it. Otherwise the process's PID and so forth is soley the web server's concern.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-la

Have no idea on what the below error message is: Process not running: /opt/java15/jdk/bin/java -classpath /opt/apache/apache-ant-1.7.0-mod/lib/ant-launcher.jar org.apache.tools.ant.launch.Launcher -buildfile build.xml dist. Any help? (3 Replies)
Discussion started by: gull05
3 Replies

2. Shell Programming and Scripting

Finding process which ended another process

Hello, The scenario is as follows, I have a background process running initially for which i know the PID on machine1. I use ssh from machine 2 to execute a script in machine 1. For some reason the back ground process is terminated. I would like to know which process caused the... (6 Replies)
Discussion started by: prasbala
6 Replies

3. Shell Programming and Scripting

Process behavior different when spawned from single terminal

So this one just plain confuses me. I have a bunch of somewhat CPU intensive processes that all communicate using a shared memory region. Some of these programs are threaded and some also change the scheduling to FIFO or round robin. The good news is that everything works as long as I spawn... (3 Replies)
Discussion started by: talkingfennel
3 Replies

4. Shell Programming and Scripting

How to keep process running after apache restart.

I have posted this on the Web subforum but it seems that nobody knows to do this, maybe someone has a solution here. Thank you I have a PHP application that starts a couple of processes on the server...the problem is that if I restart apache those running apps will die. How can I start them... (1 Reply)
Discussion started by: valiadi
1 Replies

5. Shell Programming and Scripting

Suppressing output of a spawned telnet process

Hi, I'm trying to spawn a telnet process and trying to do some actions in the remote host using expect script. I would like to know how to suppress all the output in order the user using the script should not be able to see any actions done on the remote host. I tried using the "log_user 0"... (8 Replies)
Discussion started by: arun_maffy
8 Replies

6. UNIX for Advanced & Expert Users

Finding process id of subsequent process

hi all, I am trying to find the process id of the subsequent process created via fork and exec calls in perl. For eg: envVarSetter dataCruncher.exe < input.txt > output.txt When I fork and exec the above command, it returns only the pid of envVarSetter and I don't know how to find the... (9 Replies)
Discussion started by: matrixmadhan
9 Replies

7. Shell Programming and Scripting

Finding the process id of the process using the ports

Hi Any idea how to get the process id of the process using the ports lsof -i :portnumber does not work in my machine. I am on sun Solaris SPARC. Any suggestion is highly appreciated (1 Reply)
Discussion started by: kinny
1 Replies

8. Shell Programming and Scripting

need help with this background wget process.

I run an online game, and every 10 seconds or so i need to "run" a file. In other words in needs to be executed. Its a PHP file. The file updates vital things in my game, each time it does it its know as a "tick". Here is the code i am using. (wget... (2 Replies)
Discussion started by: mikey1090
2 Replies

9. Shell Programming and Scripting

Keep process running (wget) and logout

well, i have only been learning about linux, unix and shells for a few days. For my online game to work, i need run a file each 10 seconds. Running that file will update mysql data, causing my online game to "tick". This adds resources and fights battles in game. I know that i need to use a... (3 Replies)
Discussion started by: mikey1090
3 Replies

10. Shell Programming and Scripting

Is there any cmd to kill a process including its childs ( or sub processes spawned by

Dear Unix Gurus, Here is my query. If i start a script,it inturn calls many other scripts ..and most of them continue to run in parallel. Suppose,if i want to stop my script for some reason,i need to kill -9 each of the processes running.It becomes clumsy if the sub processes r more. ... (15 Replies)
Discussion started by: gvsreddy_539
15 Replies
Login or Register to Ask a Question