Sometimes it’s hard to remember how cool `awk` used to be – I haven’t used `awk` ever since I switched to Perl about 15 years ago. 😄
Today I wondered who had so many sleeping php-cgi processes on the server hosting Campaign Wiki:
ps aux | awk '/php-cgi$/ { user[$1]++} END { for (u in user) { print u, user[u] }}' 1231 233 greywulf 1
Thanks, `awk`. You might be awkward to use, but you get the job done. Now we just need to figure out who this user 1231 is. Who needs 233 php-cgi processes running?
#Software
(Please contact me if you want to remove your comment.)
⁂
Wish I could figure out what’s causing these. Most annoying :\
– greywulf 2012-10-17 21:25 UTC
---
Not your fault! When I looked you had one php-cgi process running. That makes total sense. It was this other user id that had more than 200 sleeping processes running that I cared about. (Added this clarification to the blog post, too.)
– Alex Schroeder 2012-10-18 07:00 UTC