Skip to content

Instantly share code, notes, and snippets.

@brianhillz0r
Forked from hydra35/batch-strace.sh
Created May 16, 2014 18:42
Show Gist options
  • Save brianhillz0r/96620829f91579baaa72 to your computer and use it in GitHub Desktop.
Save brianhillz0r/96620829f91579baaa72 to your computer and use it in GitHub Desktop.
#!/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