Skip to content

Commit

Permalink
add update script (#67)
Browse files Browse the repository at this point in the history
* add update script

* add crontab exemple
  • Loading branch information
MateoLostanlen authored Mar 17, 2022
1 parent c826e7d commit 07d05b0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pyroengine/pi_utils/update_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# This script performs:
# pull origin master
#- if any change:
# kill container
# rebuild docker compose
#
# This script must be run with a crontab
# */10 * * * * bash /home/pi/pyro-engine/pyroengine/pi_utils/update_script.sh


CID=$(docker ps | grep server_web | awk '{print $1}')

if [ `git -C /home/pi/pyro-engine pull origin master | grep -c "up to date."` -ne 1 ];
then
echo "pyro-engine updated from github";
cd /home/pi/pyro-engine/server/;
docker kill CID;
echo "rebuild docker";
PORT=8002 docker-compose up -d --build;
else
echo "pyro-engine up to date";
fi;

0 comments on commit 07d05b0

Please sign in to comment.