¡Hyperling.com 2.0! #16
20
cronjob.sh
20
cronjob.sh
@@ -27,14 +27,24 @@ function reload-project {
|
||||
## Main ##
|
||||
|
||||
# Pull any updates, and if the project is already up to date, exit successfully.
|
||||
git pull | grep -v "up to date"
|
||||
status="$?"
|
||||
log "Pull status is '$status'."
|
||||
if [[ $status != 0 ]]; then
|
||||
output="`git pull`"
|
||||
git_status="$?"
|
||||
|
||||
echo "$output" | grep -v "up to date"
|
||||
grep_status="$?"
|
||||
|
||||
log "Pull status is '$git_status', anything but 'up to date' is '$grep_status'."
|
||||
|
||||
if [[ $git_status != 0 ]]; then
|
||||
log "*** ERROR: Git reported a failure! ***"
|
||||
exit 1
|
||||
elif [[ $git_status == 0 && $grep_status == 0 ]]; then
|
||||
reload-project
|
||||
elif [[ $git_status == 0 && $grep_status != 0 ]]; then
|
||||
log "Site is already up to date, exiting."
|
||||
exit 0
|
||||
else
|
||||
reload-project
|
||||
log "*** WARNING: Unknown Situation ***"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user