How to know how many files are running.?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to know how many files are running.?
# 1  
Old 12-13-2012
How to know how many files are running.?

Hi friends

I want to know can we check how many php files are running currently or can we know that a file is running or not.

Maine issue is that i am running two or three files, there are lots of code on them, each files takes 20 minutes to complete. i want to know that first file is completed or not using shell command, so any other file will not be run untill first one complete its all process.

thanks
# 2  
Old 12-13-2012
use wait command
# 3  
Old 12-13-2012
You can search through
Code:
ps

command whther your
Code:
php

code is running or not.

Code:
ps -ef | grep php

And for the second question as pointed by Itkamaraj you need to use
Code:
wait

command. It will make sure that the second process will not start untill the first will get over.
# 4  
Old 12-13-2012
but i have not got proper details such as currently i am running a script xyz.sh which in below directory
home/httpd/html/vhosts/abc.com/htdocs/shscript/xyz.sh
now i want to get that 'index.php' is running or not ?
path for this file 'home/httpd/html/vhosts/abc.com/htdocs/index.php'.

now in xyz.sh
i want to run index.php and index2.php , but it index2.php should be run when index.php has completed its all process.
But below code
Code:
ps -ef | grep php

gives me
Code:
546      12739 12455  0 08:33 pts/0    00:00:00 grep php

now how can i know index.php is running or not ??
# 5  
Old 12-13-2012
index.php running via apache right ?

Or are you triggering the index.php in your xyz.sh as php home/httpd/html/vhosts/abc.com/htdocs/index.php ?
# 6  
Old 12-13-2012
Try

Code:
ps -ef | grep "xyz.sh"

and
Code:
ps -ef grep "index.php"

If you are running it in your apache server than you might want to try the
Code:
ps aux | grep process name

command over their.

Last edited by Vikram_Tanwar12; 12-13-2012 at 05:19 AM..
# 7  
Old 12-13-2012
Quote:
Originally Posted by itkamaraj
index.php running via apache right ?

Or are you triggering the index.php in your xyz.sh as php home/httpd/html/vhosts/abc.com/htdocs/index.php ?
Yes i am triggering with same method, not from apache. running these php files from sh only

---------- Post updated at 04:28 PM ---------- Previous update was at 04:23 PM ----------

I am now getting
Code:
[root@405373-db1 shscript]# ps -ef | grep "index.php"
root     21951 12308  0 10:55 pts/1    00:00:00 grep index.php

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell file to run other shell files running jar files

Hi, I am trying to write a shell script that will go to another folder and run the script in that folder. The folder structure is kind of like this: /MainFolder/ |-> MainShellScript.sh | |-> Folder1/ |-----|-> script1.sh |-----|-> FileToRun1.jar | |-> Folder2/ |-----|-> script2.sh... (3 Replies)
Discussion started by: sleo
3 Replies

2. Shell Programming and Scripting

Can I skip files when running rm command

Platform: Oracle Enterprise Linux 6.2 I have several files like below. I want to remove all files except one file For example , I want to remove all the files below except dasd_91197.trc $ ls -alrt *.trc -rw-r----- 1 ecmdev wms 8438784 May 7 21:30 dasd_91177.trc -rw-r----- 1 ecmdev wms ... (3 Replies)
Discussion started by: John K
3 Replies

3. Shell Programming and Scripting

Running a script over a series of files

Hi, I want to run a script over a series of files with the names : Sample_1.sorted.bam Sample_2.sorted.bam Sample_3.sorted.bam How can I specify it in my script. Thanks a lot in advance. (3 Replies)
Discussion started by: Homa
3 Replies

4. Shell Programming and Scripting

Running tcl Files in C shell

hello, debashish here.Can any body tell me, how to execute tcl files in a C shell. i am working in synopsys tool for synthesis work. plz help me out.:confused::wall: $ source /packages/synopsys/setup/create_dir_setup.tcl $ source /packages/synopsys/setup/synopsys_setup.tcl i want to execute... (1 Reply)
Discussion started by: DEBASHISH DASH
1 Replies

5. Shell Programming and Scripting

Running a script with all files in a folder

Hi I have many files in a folder (like 200) and I want to run a Perl script through all of them. One way would be to do it one by one (which will take forever). But I am sure there is a faster way of doing it. So inside the folder i have files named in no particular way eg. YUI456... (3 Replies)
Discussion started by: phil_heath
3 Replies

6. Shell Programming and Scripting

Running md5sum on a list of files

Hello, I would like to run md5sum on a list of files saved in a text file, and save the result in another file. (ie. md5sum `cat list.txt` > md5list.txt) I have tried several things, but I am always confronted to the same problem: some of the filenames have spaces. I have run sed on the... (5 Replies)
Discussion started by: SDelroen
5 Replies

7. UNIX for Dummies Questions & Answers

Running elf files

I have a few questions about elf files and how they are executed. When gcc compiles a elf file it creates an executable. Is this executable then run directly by the hardware or does the kernel get involved, interpret the elf file and place the asm code directly in memory. Cheers (0 Replies)
Discussion started by: mshindo
0 Replies

8. UNIX for Dummies Questions & Answers

running files

I want to run a server program that I wrote in java on my unix shell. The file has the .jar extension. I've loaded the file onto my unix shell but I can't seem to figure out how to run it. Is this possible? if so, how do I go about doing that? (1 Reply)
Discussion started by: Enduser
1 Replies

9. Shell Programming and Scripting

running files consecutively with one command

i want to run few c object files one after another in one command. Can i write a acript for that. I'm using Sun Solaris. for example ./prog < input1 >output1 & ./prog <input2 >output2 & i want the first to finish before starting the nest one and run them in the back ground thanks.... (5 Replies)
Discussion started by: narom
5 Replies

10. UNIX for Dummies Questions & Answers

Running EXE files on UNIX

I'm trying to find out if a executible file created in visual basic will run in the CGI-BIN of a unix server. I see the C section but no mention of VB. Thanks Sean (1 Reply)
Discussion started by: seanstog
1 Replies
Login or Register to Ask a Question