2017-04-05 05:50:03 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This just checks the time every 60 seconds to see if it should run the benchmarks.
|
|
|
|
# This is a hack to work around cron's/automator's inability to start GUI apps
|
|
|
|
# using `npm start`.
|
|
|
|
|
|
|
|
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
BENCHMARK_SCRIPT=$CWD/benchmark-new-commits.sh
|
2017-04-06 06:34:13 +08:00
|
|
|
UPLOAD_SCRIPT=$CWD/upload-benchmark-data.py
|
|
|
|
BENCHMARK_RESULTS_DIR=$HOME/.benchmark_results
|
2017-04-05 05:50:03 +08:00
|
|
|
TARGET_TIME="$1"
|
|
|
|
|
|
|
|
if [[ $# != 1 ]]
|
|
|
|
then
|
|
|
|
echo "Usage: run-once-per-day.sh '23:00'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
while [[ true ]]
|
|
|
|
do
|
|
|
|
CURRENT_TIME=$(date +"%H:%M")
|
|
|
|
|
|
|
|
if [[ $CURRENT_TIME = $TARGET_TIME ]]
|
|
|
|
then
|
|
|
|
/bin/bash $BENCHMARK_SCRIPT
|
2017-04-06 06:34:13 +08:00
|
|
|
python $UPLOAD_SCRIPT $BENCHMARK_RESULTS_DIR
|
2017-04-05 05:50:03 +08:00
|
|
|
fi
|
|
|
|
sleep 60
|
|
|
|
done
|
|
|
|
|