#!/bin/bash

BRANCH="master"
LOG_FILE="script.log"

[ ! -f $LOG_FILE ] && touch $LOG_FILE

logs() {
	echo "[$(date +"%d-%m-%y %T%z")] $*" >> $LOG_FILE
}

logs "START RUN"

if [ -z $BRANCH ]; then
	logs "No arg defined"
	exit 1
fi

if [ ${BRANCH,,} = "master" ]; then
	logs "Call git for pull $BRANCH"
	cd ../gestion.agenceloasis.fr/
	git pull 2>&1 >> ./$LOG_FILE
else
	logs "Wrong Branch : $BRANCH"
fi