Mailspring/scripts/run-once-per-day.sh
Mark Hahnenberg 965946724b [client-app] Some final benchmark fixes
Summary: See title

Test Plan: Run on the coffee machine

Reviewers: juan, evan, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D4368
2017-04-05 15:59:17 -07:00

30 lines
711 B
Bash

#!/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
UPLOAD_SCRIPT=$CWD/upload-benchmark-data.py
BENCHMARK_RESULTS_DIR=$HOME/.benchmark_results
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
python $UPLOAD_SCRIPT $BENCHMARK_RESULTS_DIR
fi
sleep 60
done