Sample scripts from Sharon
This commit is contained in:
parent
8b9c5d4898
commit
9c0d9ad324
extras/sample-cron-scripts
10
extras/sample-cron-scripts/capture.sh
Executable file
10
extras/sample-cron-scripts/capture.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Start the ethstream capture using nilm-pipewatch
|
||||
|
||||
# Bail out on errors
|
||||
set -e
|
||||
|
||||
nilm-pipewatch --daemon --lock "/tmp/nilmdb-capture.lock" --timeout 30 \
|
||||
"ethstream -a 192.168.1.209 -n 9 -r 8000 -N" \
|
||||
"nilm-insert -m 10 -r 8000 --live /sharon/raw"
|
8
extras/sample-cron-scripts/cleanup.cfg
Normal file
8
extras/sample-cron-scripts/cleanup.cfg
Normal file
|
@ -0,0 +1,8 @@
|
|||
[/sharon/prep-*]
|
||||
keep = 1y
|
||||
|
||||
[/sharon/raw]
|
||||
keep = 2w
|
||||
|
||||
[/sharon/sinefit]
|
||||
keep = 1y
|
9
extras/sample-cron-scripts/crontab
Normal file
9
extras/sample-cron-scripts/crontab
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Install this by running "crontab crontab" (will replace existing crontab)
|
||||
|
||||
# m h dom mon dow cmd
|
||||
|
||||
# Run NilmDB processing every 5 minutes
|
||||
*/5 * * * * chronic /home/nilm/data/process.sh
|
||||
|
||||
# Check the capture process every minute
|
||||
*/1 * * * * chronic /home/nilm/data/capture.sh
|
28
extras/sample-cron-scripts/process.sh
Executable file
28
extras/sample-cron-scripts/process.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
# Run all necessary processing on NilmDB data.
|
||||
|
||||
# Bail out on errors
|
||||
set -e
|
||||
|
||||
# Ensure only one copy of this code runs at a time:
|
||||
LOCKFILE="/tmp/nilmdb-process.lock"
|
||||
exec 99>"$LOCKFILE"
|
||||
if ! flock -n -x 99 ; then
|
||||
echo "NilmDB processing already running, giving up..."
|
||||
exit 0
|
||||
fi
|
||||
trap 'rm -f "$LOCKFILE"' 0
|
||||
|
||||
# sinefit on phase A voltage
|
||||
nilm-sinefit -c 5 /sharon/raw /sharon/sinefit
|
||||
|
||||
# prep on A, B, C with appropriate rotations
|
||||
nilm-prep -c 1 -r 0 /sharon/raw /sharon/sinefit /sharon/prep-a
|
||||
nilm-prep -c 2 -r 120 /sharon/raw /sharon/sinefit /sharon/prep-b
|
||||
nilm-prep -c 3 -r 240 /sharon/raw /sharon/sinefit /sharon/prep-c
|
||||
|
||||
# decimate raw and prep data
|
||||
nilm-decimate-auto /sharon/raw /sharon/prep*
|
||||
|
||||
# run cleanup
|
||||
nilm-cleanup --yes /home/nilm/data/cleanup.cfg
|
Loading…
Reference in New Issue
Block a user