From a00f66f72ff7186bce9b49a7402d584cc5b09685 Mon Sep 17 00:00:00 2001 From: Scott Leibrand Date: Sat, 21 Jan 2017 19:48:38 -0800 Subject: [PATCH 1/4] script for autotuning based on day of week --- bin/oref0-autotune-dayofweek.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 bin/oref0-autotune-dayofweek.sh diff --git a/bin/oref0-autotune-dayofweek.sh b/bin/oref0-autotune-dayofweek.sh new file mode 100644 index 00000000..d8dcdfcd --- /dev/null +++ b/bin/oref0-autotune-dayofweek.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# This script allows you to run autotune separately for each day of the week + +DOW=$(date +%u) + +if [ -z $myopenaps ] || [ -z $nsurl ]; then + echo "Usage: $0 ~/myopenaps http://mynightscouthost.herokuapp.com" +fi + +# if we have a day of week profile file, copy that over before autotuning +if [ -e $myopenaps/autotune/profile-day$DOW.json ]; then + cp $myopenaps/autotune/profile-day$DOW.json $myopenaps/autotune/profile.json +fi + +# do the regular autotune and update autotune.json, and then +# copy the updated profile.json back to the day of week profile file +oref0-autotune -d=$myopenaps -n=$nsurl \ +&& cat $myopenaps/autotune/profile.json | json | grep -q start \ +&& cp $myopenaps/autotune/profile.json $myopenaps/settings/autotune.json \ +&& cp $myopenaps/autotune/profile.json $myopenaps/autotune/profile-day$DOW.json From 534c4d3d8eeade30d21b64dbaa3a959f95e17627 Mon Sep 17 00:00:00 2001 From: Scott Leibrand Date: Sat, 21 Jan 2017 19:51:46 -0800 Subject: [PATCH 2/4] +x --- bin/oref0-autotune-dayofweek.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bin/oref0-autotune-dayofweek.sh diff --git a/bin/oref0-autotune-dayofweek.sh b/bin/oref0-autotune-dayofweek.sh old mode 100644 new mode 100755 From 951a4815fca2b3706aba1328abf2081f4d6fbff4 Mon Sep 17 00:00:00 2001 From: Scott Leibrand Date: Sat, 21 Jan 2017 19:57:23 -0800 Subject: [PATCH 3/4] exit on usage --- bin/oref0-autotune-dayofweek.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/oref0-autotune-dayofweek.sh b/bin/oref0-autotune-dayofweek.sh index d8dcdfcd..277fbe51 100755 --- a/bin/oref0-autotune-dayofweek.sh +++ b/bin/oref0-autotune-dayofweek.sh @@ -6,6 +6,7 @@ DOW=$(date +%u) if [ -z $myopenaps ] || [ -z $nsurl ]; then echo "Usage: $0 ~/myopenaps http://mynightscouthost.herokuapp.com" + exit fi # if we have a day of week profile file, copy that over before autotuning From a54b21c4ec093384cf4d7aef745e6e6ec40e95a3 Mon Sep 17 00:00:00 2001 From: Scott Date: Sat, 21 Jan 2017 19:59:25 -0800 Subject: [PATCH 4/4] accept command-line arguments --- bin/oref0-autotune-dayofweek.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/oref0-autotune-dayofweek.sh b/bin/oref0-autotune-dayofweek.sh index 277fbe51..e7fb067a 100755 --- a/bin/oref0-autotune-dayofweek.sh +++ b/bin/oref0-autotune-dayofweek.sh @@ -2,6 +2,8 @@ # This script allows you to run autotune separately for each day of the week +myopenaps=$1 +nsurl=$2 DOW=$(date +%u) if [ -z $myopenaps ] || [ -z $nsurl ]; then