Skip to content

Instantly share code, notes, and snippets.

@guysmoilov
Created August 23, 2016 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guysmoilov/cffc6d088b64a38592d0f08bd8f86159 to your computer and use it in GitHub Desktop.
Save guysmoilov/cffc6d088b64a38592d0f08bd8f86159 to your computer and use it in GitHub Desktop.
Watch command for long-term monitoring
echo "Watching $1 command"
PREV=""
while sleep 1; do
CURRENT=`eval $1`
if [ "$CURRENT" != "$PREV" ]; then
echo "[`date`]: $CURRENT"
PREV=$CURRENT
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment