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

show execution time; compress logfile

parent 1cd677f8
Branches
No related tags found
No related merge requests found
......@@ -3,6 +3,9 @@
myCommand="/opt/snow/snowagent -w /opt/snow/"
logfile="/tmp/snowagent-trace-$( date +%Y%m%d-%H%M%S ).log"
# ----------------------------------------------------------------------
# MAIN
# ----------------------------------------------------------------------
echo "
......@@ -14,7 +17,9 @@ A log will be generated: $logfile¨
"
read -p "Press RETURN to continue or Ctrl+C to abort"
# ----------------------------------------------------------------------
echo "Initializing $myCommand ... "
sudo bash -c "$myCommand" &
echo "Searching processes ... "
......@@ -22,6 +27,18 @@ 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"
time sudo strace -p $pid 2>&1| tee "$logfile"
echo
ls -l "$logfile"
# ----------------------------------------------------------------------
echo
echo "Logfile:"
ls -lh "$logfile"
echo -n "Compressing it wht gzip ..."
gzip "$logfile"
echo " done."
ls -lh "$logfile.gz"
echo
# ----------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment