Skip to content

Instantly share code, notes, and snippets.

@rahul286
Forked from hydra35/batch-strace.sh
Created November 7, 2012 17:19
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 rahul286/4033040 to your computer and use it in GitHub Desktop.
Save rahul286/4033040 to your computer and use it in GitHub Desktop.
strace all the php-fpm worker processes
#!/bin/bash
additional_strace_args="$1"
MASTER_PID=$(ps auwx | grep php-fpm | grep -v grep | grep 'master process' | cut -d ' ' -f 6)
while read -r pid;
do
if [[ $pid != $MASTER_PID ]]; then
nohup strace -r -p "$pid" $additional_strace_args >"$pid.trc" 2>&1 &
fi
done < <(pgrep php-fpm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment