Skip to content
Snippets Groups Projects
Commit 1cd677f8 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add trace run

parent b86ace69
No related branches found
No related tags found
No related merge requests found
trace.sh 0 → 100755
#!/bin/bash
myCommand="/opt/snow/snowagent -w /opt/snow/"
logfile="/tmp/snowagent-trace-$( date +%Y%m%d-%H%M%S ).log"
echo "
TRACE RUN
Starting '$myCommand' in backgrund and start strace on its PID.
A log will be generated: $logfile¨
"
read -p "Press RETURN to continue or Ctrl+C to abort"
sudo bash -c "$myCommand" &
echo "Searching processes ... "
ps -ef | grep "$myCommand" | grep -v "bash"
pid=$( ps -ef | grep "$myCommand" | grep -v "bash" | head -1 | awk '{ print $2 }' )
echo "Watching process $pid ..."
sudo strace -p $pid 2>&1| tee "$logfile"
ls -l "$logfile"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment