-
Chris Croome authoredChris Croome authored
cron.j2 584 B
#!/bin/bash
# $LOGNAME is set to {{ item }} when this script is run via cron and is
# unset when run via a terminal
if [[ "${LOGNAME}" != "{{ item }}" ]]; then
if [[ "${USER}" != "{{ item }}" ]]; then
echo "This script should be run as {{ item }}, please sudo first"
echo "sudo -u {{ item }} -s /bin/bash"
echo "${0}"
exit
fi
fi
cd ~/sites
# Remove any untracked files/directories
# see https://github.com/cotech/website/issues/79
#git clean -fd
GIT_PULL=$(git pull | grep -v "up-to-date")
if [[ ${GIT_PULL} != "" ]]; then
/home/{{ item }}/bin/update
fi