Skip to content

Instantly share code, notes, and snippets.

@spiermar
Created March 21, 2013 23:41
Show Gist options
  • Save spiermar/5217833 to your computer and use it in GitHub Desktop.
Save spiermar/5217833 to your computer and use it in GitHub Desktop.
#!/bin/bash
ps -A -o pid,rss,command | grep nginx | grep -v grep | awk '{total+=$2}END{printf("nginx=%dMb\n", total/1024)}'
ps -A -o pid,rss,command | grep php-fpm | grep -v grep | awk '{total+=$2}END{printf("php-fpm=%dMb\n", total/1024)}'
ps -A -o pid,rss,command | grep mysqld | grep -v grep | awk '{total+=$2}END{printf("mysql=%dMb\n", total/1024)}'
ps -A -o pid,rss,command | grep transmission-da | grep -v grep | awk '{total+=$2}END{printf("transmission=%dMb\n", total/1024)}'
ps -A -o pid,rss,command | grep fail2ban | grep -v grep | awk '{total+=$2}END{printf("fail2ban=%dMb\n", total/1024)}'
ps -A -o pid,rss,command | grep sshd | grep -v grep | awk '{total+=$2}END{printf("sshd=%dMb\n", total/1024)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment