Skip to content

Instantly share code, notes, and snippets.

@unfo
Created January 23, 2014 07:58
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 unfo/8574668 to your computer and use it in GitHub Desktop.
Save unfo/8574668 to your computer and use it in GitHub Desktop.
Very naive/simplistic logger to see how incoming file transfers are moving => able to gauge transfer speeds of files and/or total halt of transfers after the fact.
#!/bin/bash
# crontab example:
# 30 20 * * * echo "" > /tmp/bar ; /data/network-debugging/ls-logger.sh
# 30 08 * * * echo 1 > /tmp/bar
INPUT_DIR=/data/foobar/input
DTM="$(date +%Y-%m-%d-%H-%M)"
LOGFILE="/data/network-debugging/ls.log-$DTM"
foo=`cat /tmp/bar`
while [ "$foo" == "" ]; do
ls --full-time $INPUT_DIR | xargs -n1 -I% sh -c 'echo -e "$(date --rfc-3339=ns) %"' >> $LOGFILE
sleep 1
foo=`cat /tmp/bar`
done
gzip $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment