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.

Revisions

  1. Kalvisan created this gist Jul 31, 2018.
    18 changes: 18 additions & 0 deletions git-update.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/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"