Please create an agent that would run in the background on Linux VMs and attach strace to every instance of the target process. Example:
#!/bin/bash
# Replace this with the name of the program you want to monitor
PROGRAM_NAME="your_program_name"
# Loop until the process starts
while true; do
# Check if the process is running
PID=$(pgrep -x "$PROGRAM_NAME")
if [ -n "$PID" ]; then
echo "Process $PROGRAM_NAME with PID $PID started. Attaching strace..."
# Attach strace to the process
strace -p "$PID" -o /tmp/strace_output_"$PID".txt &
break
fi
# Wait for a short period before checking again
sleep 1
Please create an agent that would run in the background on Linux VMs and attach strace to every instance of the target process. Example: