Skip to content

Instantly share code, notes, and snippets.

@halfb00t
Forked from hydra35/batch-strace.sh
Created February 16, 2018 11:47
Show Gist options
  • Save halfb00t/749f47e9bc7d99414a5086fc794aa459 to your computer and use it in GitHub Desktop.
Save halfb00t/749f47e9bc7d99414a5086fc794aa459 to your computer and use it in GitHub Desktop.

Revisions

  1. @hydra35 hydra35 revised this gist Mar 12, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion batch-strace.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,12 @@
    #!/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" >"$pid.trc" 2>&1 &
    nohup strace -r -p "$pid" $additional_strace_args >"$pid.trc" 2>&1 &
    fi
    done < <(pgrep php-fpm)
  2. @hydra35 hydra35 renamed this gist Feb 23, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @hydra35 hydra35 created this gist Feb 23, 2012.
    10 changes: 10 additions & 0 deletions batch-strace
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/bash

    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" >"$pid.trc" 2>&1 &
    fi
    done < <(pgrep php-fpm)