diff --git a/app.sh b/app.sh index 0910681..66b6211 100644 --- a/app.sh +++ b/app.sh @@ -1,6 +1,18 @@ #!/bin/bash + GIT_REPO_PATH=$(mktemp -d) + + git config --global user.email "$GIT_USER_MAIL" + git config --global user.name "$GIT_USERNAME" + + echo "clone repository..." + GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet &> /dev/null + cd "$GIT_REPO_PATH" + while true ; do + echo "pull repository..." + git pull --quiet &> /dev/null + echo "check variables..." if [ -z "$INTERVAL" ] ; then echo "INTERVAL is not set." @@ -35,15 +47,6 @@ while true ; do exit 3 fi - GIT_REPO_PATH=$(mktemp -d) - - git config --global user.email "$GIT_USER_MAIL" - git config --global user.name "$GIT_USERNAME" - - echo "clone repository..." - GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -i $GIT_REPO_DEPLOY_KEY" git clone "$GIT_REPO_URL" "$GIT_REPO_PATH" --quiet &> /dev/null - cd "$GIT_REPO_PATH" - # Save the current value of IFS to restore later OLD_IFS=$IFS