#!/bin/bash update() { cd $1 STATUS="$(git pull)" if [ "$STATUS" != "Already up-to-date." ] && [ "$STATUS" != "Already up to date." ] then echo "[$(/bin/date +%Y-%m-%d\ %H:%m)] $2 updated" echo $STATUS if [ "$3" != "" ] then service $3 restart fi fi } update /www/htdoc "Example Website" "service name" # update /www/htdoc/website2 "Example v2 Website" "service v2 name"