Skip to content

Instantly share code, notes, and snippets.

@hansode
Created September 6, 2013 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hansode/6461132 to your computer and use it in GitHub Desktop.
Save hansode/6461132 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# requires:
# bash
# cat, pidstat
#
set -e
LANG=C
LC_ALL=C
pidfile=/var/run/td-agent/td-agent.pid
[[ -f ${pidfile} ]] || {
echo "no such file: ${pidfile}" >&2
exit 1
}
pid=$(cat ${pidfile})
ps -p ${pid} >/dev/null || {
echo "no such pid: ${pid}" >&2
exit 1
}
pidstat -h -r -u -p ${pid} 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment