#!/bin/bash set -e while read oldrev newrev ref do if [[ ! $ref =~ .*/master$ ]] then continue fi myHost=$(hostname) repoDir=$(dirname "$0")/.. projectName=$(basename "$(realpath "$repoDir")") echo "Ref $ref received. It will be deployed automatically." echo "Host $myHost" echo "$projectName" "master" > /tmp/vn-repo.changes #nohup sudo -u vn-repo "vn-branch $projectName" &> /dev/null & done