Start Time and period of a PID

Thread Tools Search this Thread
# 1  
Question Start Time and period of a PID


Below is my OS details.

uname -an
SunOS mymachine 5.10 Generic_144488-07 sun4v sparc SUNW,SPARC-Enterprise-T5220

I need to know when was my Apache server last started. Whats is the best and most reliable way to find out not just for Apache but for any PID per say?

I am also confused as to what is the best way to find the PID[unique] of the apache server running on my unix box.

Below command returns multiple PIDs which is confusing.

ps -ef | grep -i "httpd"

wlsuser 15709  8392   0 03:55:18 ?           0:29 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con
wlsuser  8459  8392   0   Nov 20 ?           0:00 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con
wlsuser  8392  6839   0   Nov 20 ?           5:25 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con
wlsuser  7019  8392   0 00:24:51 ?           3:12 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con
wlsuser 26856 26159   0 04:19:11 pts/2       0:00 grep -i httpd
wlsuser  3514  8392   0 22:13:07 ?           4:05 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con
wlsuser 25218  8392   0 00:03:23 ?           3:11 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con
wlsuser 13385  8392   0 23:40:55 ?           3:18 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con

# 2  
All those httpd processes have the same PPID: 8392, so this is the one which spawned the other children.
They have been spawned most probable to compensate traffic as more clients connected over time. Using the STIME of ps which would be
wlsuser  8392  6839   0   Nov 20 ?           5:25 /apps/apache22/bin/httpd_worker -DSSL -k start -f /apps/apache22/conf/httpd.con

is correct.
# 3  

There are three concerns here.

1. I knew that the parent PID is always displayed first and the child displayed second. However this is the first time i see that the parent PID is displayed after the child PIDs.

2. The STIME mentioned which in this case shows Nov 20 does not specify the time but just the date. I need the time as well.

3. I am also sure that my apache was resatrted yesterday so Nov 20 does not seem correct to me.

Also please help me understand technically how does "spawned the other children" help increase performance and how and when it decides to spawn. Any article on the same would be appreciated.

Kindly help.
# 4  
ps -ef|head -1 

The order of the columns shows PID then PPID (parent PID).
# 5  
Standard headings for ps -ef are

Check out the thread related config items in this article but basically, rather than queue requests the httpd has available threads waiting to handle requests until you reach the maximum number of threads
# 6  

Ok that answers 2 / 3 questions I had.

However, I still cannot get the start date and time for my apache process.

It was restarted yesterday and not on Nov 20.

Can you please help?

Also, why does

ls -ltr | head -1

not show me the column headings?
# 7  
Try stopping it. If you only have 1 httpd running there and there are httpd processes left after stopping it, they might be some runaway processes. From your output they do not look like that though.
After being stopped and cleaning up dead processes, start it anew and check with ps.
You can also check the log file of your httpd for the start time. It should write something appropriate in there.

Your line of code gives no header of ps as you used a wrong command.
This User Gave Thanks to zaxxon For This Post:

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #422
Difficulty: Medium
C# has support for strongly-typed function pointers via the keyword delegate.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Terminate TCPDUMP in a certain time period

Hello All, As I stated in subject, I need a command to terminate my tcpdump command in a certain time period. (using HP-UX) I am using below one to terminate when number of captured packages reach 3 limit. But what if there will no packet come in 5 min for instance? Please help me to find a... (2 Replies)
Discussion started by: mrcrowley
2 Replies

2. Shell Programming and Scripting

To get the Files between Time Period

All, How to get the list of files through a unix command which exists / created / updated between 8 PM to 11:59 PM from a particular location. Regards Oracle User (3 Replies)
Discussion started by: Oracle_User
3 Replies

3. Shell Programming and Scripting

Get connection count over a period of time

I used this script to get the connection to a domain in two specific minutes. I need to extend to give result over a range of minutes. The below gives total number of connections in the minutes 00:40 and 01:13 on 22nd March. egrep "22/Mar/2013:00:40|22/Mar/2013:01:13"... (1 Reply)
Discussion started by: anil510
1 Replies

4. HP-UX

memory consumption over a time period

Hi, Can some one please tell me how do I generate a report of the Memory Consumption over a time period: HP-UX B.11.31 U ia64 0440531406 unlimited-user license I normally use glance to monitor memory in run time. Note: I do not have root privileges. Thanks Danish ... (5 Replies)
Discussion started by: danish0909
5 Replies

5. Shell Programming and Scripting

grep /target greater than time period??

Hey guys, I'm fairly new at unix shell scripting and I have a quick question. Quick overview I devolped a script where I generate a file ..and I want to grep any time greater than 30 minutes. What i do is runa command to generates the below and puts it into a file: I run ./ggsci << endit... (4 Replies)
Discussion started by: nomiezvr4
4 Replies

6. Shell Programming and Scripting

Calculate Time Period in Scripting

Hi all, now i am writting one bash script. in that my requirement is i need to create one directory and that the directory details to be stored in one file Ex. date/time and all in one file. after that i need to delete the folder automatically exactly after 3months. between these time... (5 Replies)
Discussion started by: anishkumarv
5 Replies

7. AIX

Read input data within a specified period of time

Hi All, I am working on a script which requires an input from user within one 1 min. So if the user gives the required input within 1 min., it will execute on the basis of input provided by the user.Other wise it will execute on a default value(hard coded inside the script). Now, I am... (19 Replies)
Discussion started by: rajsharma
19 Replies

8. UNIX for Dummies Questions & Answers

Determining load average over a period of time

How can i determine the load average of a centos server for the last 1 hour? (3 Replies)
Discussion started by: proactiveaditya
3 Replies

9. Shell Programming and Scripting

Start program in background (or start crontab ahead of time)

Hey! I'm working on a script that will add a user, create some configfiles, and add a crontab for the user. The crontab looks like the following: @reboot /home/user/program config.conf & I would like for this process to start at the end of my script under the corresponding username by... (0 Replies)
Discussion started by: noratx
0 Replies

10. Shell Programming and Scripting

Run job for a period of time

I have a job that runs for an unspecified amount of time. I want to run this as a cron job for a specified amount of time, say 2 hours. Once the time is up, the program should be killed in the middle of execution. How can I do this? Thanks. (5 Replies)
Discussion started by: cooldude
5 Replies

Featured Tech Videos