Skip to content

Instantly share code, notes, and snippets.

@cornernote
Created September 27, 2014 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cornernote/91876f50e4cb59d499d8 to your computer and use it in GitHub Desktop.
Save cornernote/91876f50e4cb59d499d8 to your computer and use it in GitHub Desktop.
Auto Git Update
<?php
$runtimePath = '/home/user/app/runtime';
if (!empty($_GET['project'])) {
if (in_array($_GET['project'], array('app'))) {
file_put_contents($runtimePath . '/update-' . $_GET['project'], '');
}
}
#!/bin/bash
################################################################################
# Git Update
################################################################################
#
# Add to cron:
# * * * * * /usr/local/bin/lockrun --lockfile=/var/lockrun/update -- /home/user/scripts/update.sh > /dev/null 2>&1
#
################################################################################
DIR=/home/user
RUNTIME=/home/user/app/runtime
if [[ -f ${RUNTIME}/update-app ]]; then
cd ${DIR}
git pull
rm -f ${RUNTIME}/update-app
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment