Blame view

software/servo/gen_stm32_log.bash 436 Bytes
14b996da3   benny   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  #/bin/bash
  
  # See on :
  # http://unix.stackexchange.com/questions/166341/constantly-check-if-file-is-modified-bash
  # !!! Need inotify-tools package
  
  INFILE=minicom.cap
  OUTFILE=stm32_pid.`date +%Y%m%d-%H%M%S`.log
  
  while inotifywait -q -e modify $INFILE >/dev/null; do
      # do whatever else you need to do
      LAST_LINE=$(tail -n 1 $INFILE)
      DATE=`date +%Y%m%d-%H%M%S`
      echo $(printf "%s %s" "$DATE" "$LAST_LINE") >> $OUTFILE
  
  done