Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Linux in General => Linux Development & Programming => Topic started by: santosh on May 07, 2004, 11:56:08 AM

Title: LINUX SCRIPT FOR GETING THE NEWSET PID
Post by: santosh on May 07, 2004, 11:56:08 AM
hi the follwing script will display all the PID's

ps -ef | grep "$1" | grep -v grep | awk '{print $1}'

but i want a script which displays only the newest PID generated.
Title: LINUX SCRIPT FOR GETING THE NEWSET PID
Post by: santosh on May 08, 2004, 03:41:07 AM
and does some one know to run the same script using php
Title: LINUX SCRIPT FOR GETING THE NEWSET PID
Post by: dragoncity99 on May 08, 2004, 05:31:06 PM
U can try to use program execution functions in php such as

exec(); to make it run on ur webserver.

Prototype for exec()

exec(string command [ array result[, int return value]])

For example:

exec("ls -la");