helmet
March 8th, 2007, 10:52 PM
script efficiency aside, when i run this
ps aux | grep apache | awk "/$1$/ { print\$2 } " | tr '\n' ',' | sed -r -e 's/,$/\n/g'
on the command line i get a nice list of PIDS seperated by comma's which is what i want. now when i run this
top -p `ps aux | grep apache | awk "/$1$/ { print\$2 } " | tr '\n' ',' | sed -r -e 's/,$/\n/g'`
to make top use that list of pids, it runs as if it skips the awk section of of things, and I get the original stuff with the commas replacing \n except at the end. wtf
is there something the ` ` doesn't like about the " " in the awk part of things? can somebody suggest a better way of doing this?
i just want to run a script to monitor all of apaches pids
even better, can somebody point me to something to realtime monitor a process (apache) for memory usage, processor time, etc and put it in a graph or something?
ps aux | grep apache | awk "/$1$/ { print\$2 } " | tr '\n' ',' | sed -r -e 's/,$/\n/g'
on the command line i get a nice list of PIDS seperated by comma's which is what i want. now when i run this
top -p `ps aux | grep apache | awk "/$1$/ { print\$2 } " | tr '\n' ',' | sed -r -e 's/,$/\n/g'`
to make top use that list of pids, it runs as if it skips the awk section of of things, and I get the original stuff with the commas replacing \n except at the end. wtf
is there something the ` ` doesn't like about the " " in the awk part of things? can somebody suggest a better way of doing this?
i just want to run a script to monitor all of apaches pids
even better, can somebody point me to something to realtime monitor a process (apache) for memory usage, processor time, etc and put it in a graph or something?