Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 29 lines (27 sloc) 0.871 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
#!/bin/bash
#
# Usage: update [restart|noop [<refspec>]]
#
# Examples:
# update # deploy latest
# update restart # deploy latest and restart services
# update restart v1.2.3 # deploy ref "v1.2.3" and restart services
# update noop v1.2.3 # deploy ref "v1.2.3"
#
# If <refspec> is not given, no "git checkout" is performed thus you get the
# latest version of whatever branch you are currently at.
#
if [ "$(whoami)" != "root" ]; then
sudo $0 $@
  exit $?
fi
cd "$(dirname "$0")"
sudo -Hu www-data git pull origin master || exit $?
if [ "$2" != "" ]; then
sudo -Hu www-data git checkout "$2" || exit $?
fi
sudo -Hu www-data git submodule update --init

if [ "$1" == "restart" ]; then
  [ -f /etc/init.d/myapp-httpd ] && invoke-rc.d myapp-httpd restart
  [ -f /etc/init.d/myapp-processor ] && invoke-rc.d myapp-processor restart
fi
Something went wrong with that request. Please try again.