Skip to content

Instantly share code, notes, and snippets.

@pronitdas
Created April 23, 2021 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pronitdas/baac0d847ae7c6b72b668ecbc63f38e2 to your computer and use it in GitHub Desktop.
Save pronitdas/baac0d847ae7c6b72b668ecbc63f38e2 to your computer and use it in GitHub Desktop.
#!/bin/bash
while true
do
cd ~/<REPO_FOLDER>
git fetch
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse @{u})
if [ $LOCAL != $REMOTE ]; then
git pull origin <TARGET_BRANCH>
docker-compose up --build -d
fi
sleep 60
done
@pronitdas
Copy link
Author

nano ~/poll.sh

contents of ~/poll.sh file ; make sure you replace REPO_FOLDER, TARGET_BRANCH, WEBHOOK_SECRET and APPLICATION_URL

make it executable

chmod +x poll.sh

crontab -e
#add the following line:
@reboot sh /home/ubuntu/poll.sh

restart system

sudo reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment