Use lock names that match the script name
[girocco.git] / jobs / updateweb.sh
blobd565d486b1110a70aa0a14c639986b60b11c5614
1 #!/bin/bash
3 set -e
5 REPO_DIR=/home/repo/repo
6 LOCK_FILE=/tmp/updateweb.lock
7 REMOTE=origin
8 BRANCH=rorcz
10 # Make sure we don't run twice.
11 if [ -s ${LOCK_FILE} ] && kill -0 $(cat ${LOCK_FILE}); then
12 echo "Already running (stuck?) with pid $(cat ${LOCK_FILE})" >&2
13 exit 1
15 echo $$ >${LOCK_FILE}
17 pushd ${REPO_DIR} > /dev/null
18 git fetch origin
19 if [ "`git rev-list $BRANCH..$REMOTE/$BRANCH`" ]; then
20 git merge --ff-only $REMOTE/$BRANCH &&
21 git submodule update &&
22 make --quiet &&
23 make install
25 popd > /dev/null
27 rm ${LOCK_FILE}