You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
954 B

  1. #!/bin/bash
  2. # Run all necessary processing on NilmDB data.
  3. # Bail out on errors
  4. set -e
  5. # Ensure only one copy of this code runs at a time:
  6. LOCKFILE="/tmp/nilmdb-process.lock"
  7. exec 99>"$LOCKFILE"
  8. if ! flock -n -x 99 ; then
  9. echo "NilmDB processing already running, giving up..."
  10. exit 0
  11. fi
  12. trap 'rm -f "$LOCKFILE"' 0
  13. # redirect stdout/stderr to log, but keep it on the console too
  14. exec > >(tee /home/nilm/data/process.log)
  15. exec 2> >(tee -a /home/nilm/data/process.log >&2)
  16. echo "sinefit on phase A voltage"
  17. nilm-sinefit -c 5 /sharon/raw /sharon/sinefit
  18. echo "prep on A, B, C with appropriate rotations"
  19. nilm-prep -c 1 -r 0 /sharon/raw /sharon/sinefit /sharon/prep-a
  20. nilm-prep -c 2 -r 120 /sharon/raw /sharon/sinefit /sharon/prep-b
  21. nilm-prep -c 3 -r 240 /sharon/raw /sharon/sinefit /sharon/prep-c
  22. echo "decimate raw and prep data"
  23. nilm-decimate-auto /sharon/raw /sharon/prep*
  24. echo "run cleanup"
  25. nilm-cleanup --yes /home/nilm/data/cleanup.cfg