Skip to main content
1 of 2
thrig
  • 35.9k
  • 4
  • 70
  • 88

Replace the script with a wrapper that runs strace that in turn launches the original script. This might involve

mv yourscript /somewhere/else/yourscript 

and then yourscript becomes

#!/bin/sh OUTPUT_TO=`mktemp /tmp/yourscript.$$.XXXXXXXXXX` || exit 1 exec strace -o $OUTPUT_TO ... /somewhere/else/yourscript "$@" 

where ... is whatever other strace arguments you need.

As an alternative, consider sysdig, as it can trace by filename or username without the need for a process ID or wrapper script.

thrig
  • 35.9k
  • 4
  • 70
  • 88