do work during while waiting 15 minutes

closes #9
This commit is contained in:
Ryan Mulligan 2018-03-19 22:37:51 -07:00
parent ba6f302cd1
commit b4e91fbc30
2 changed files with 12 additions and 2 deletions

9
up.sh
View File

@ -7,6 +7,7 @@ export NIX_PATH
PACKAGE_NAME=$1
OLD_VERSION=$2
NEW_VERSION=$3
OK_TO_PR_AT=$4
BRANCH_NAME="auto-update/$1"
@ -170,6 +171,14 @@ if [[ -v DRY_RUN ]]
then
true
else
CURRENT=$(date +%s)
if (( CURRENT < OK_TO_PR_AT ))
then
SLEEP_SECONDS=$(( OK_TO_PR_AT - CURRENT ))
echo "Sleeping $SLEEP_SECONDS seconds."
sleep "$SLEEP_SECONDS"
fi
hub pull-request -m "$PR_MESSAGE"
fi

5
ups.sh
View File

@ -31,15 +31,16 @@ echo "
$(date -Iseconds) New run of ups.sh" >> $LOG_FILE
OK_TO_PR_AT=0
IFS=$'\n'
for a in $ARGUMENTS
do
unset IFS
echo "$(date -Iseconds) $a" >> $LOG_FILE
if eval "$SCRIPT_DIR/up.sh $a 3>>$LOG_FILE"
if eval "$SCRIPT_DIR/up.sh $a $OK_TO_PR_AT 3>>$LOG_FILE"
then
echo "$(date -Iseconds) SUCCESS" >> $LOG_FILE
sleep 900
OK_TO_PR_AT=$(date +%s -d "+15 minutes")
else
echo "$(date -Iseconds) FAIL" >> $LOG_FILE
fi