2012-10-17 awk

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:

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

Comments

(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

greywulf

---

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

Alex Schroeder