Skip to content

Instantly share code, notes, and snippets.

@t0mmyt
Created August 14, 2015 10:14
Show Gist options
  • Select an option

  • Save t0mmyt/f9abce8c771a58e65b9a to your computer and use it in GitHub Desktop.

Select an option

Save t0mmyt/f9abce8c771a58e65b9a to your computer and use it in GitHub Desktop.
Monitoring
#!/bin/bash
# Count threads in use for a given user
die() {
echo $1
exit 1
}
[[ $# -eq 1 ]] || die "Need user as arg"
id $1 >/dev/null 2>&1 || die "User ($1) not found"
ps -o nlwp -u $1 | awk "NR>1{a=a+\$1} END{print a}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment