Skip to content

Instantly share code, notes, and snippets.

@Kalvisan
Created July 31, 2018 11:32
Show Gist options
  • Save Kalvisan/e8c6e189f41ad9f4c540c3bd2c15fb1c to your computer and use it in GitHub Desktop.
Save Kalvisan/e8c6e189f41ad9f4c540c3bd2c15fb1c to your computer and use it in GitHub Desktop.
Super simple git auto updater script
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment