Skip to content

Instantly share code, notes, and snippets.

@YvesChan
Last active December 20, 2015 22:59
Show Gist options
  • Save YvesChan/6209618 to your computer and use it in GitHub Desktop.
Save YvesChan/6209618 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 'master process' | tr -s ' ' | cut -d ' ' -f 2)
mkdir php-fpm-trace
pgrep fpm | while read pid
do
if [[ $pid != $MASTER_PID ]]; then
nohup strace -c -p "$pid" $additional_strace_args -o php-fpm-trae/$pid.trc 2>&1 &
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment