Changeset - df3eaea61650
[Not reviewed]
0 1 0
Brett Smith (brett) - 4 years ago 2019-11-23 14:12:35
brett@sfconservancy.org
website-update: Remove lockdir code.

Now that we're running as a systemd service, that will make sure
only one update runs at a time.
1 file changed with 0 insertions and 7 deletions:
0 comments (0 inline, 0 general)
cron/scripts/website-update.sh
Show inline comments
 
#!/bin/sh
 

	
 
set -e
 
set -u
 

	
 
LOCKDIR="/tmp/website-update.$(id -u)"
 
SITEDIR=~/website
 
PRODUCTION_BRANCH=master
 

	
 
git_rev_name() {
 
    git rev-parse --abbrev-ref --symbolic-full-name "$@"
 
}
 

	
 
if ! mkdir "$LOCKDIR"; then
 
    test -d "$LOCKDIR"
 
    exit $?
 
fi
 
trap 'rmdir "$LOCKDIR"' 0 INT TERM QUIT
 

	
 
# If the checkout is not on the production branch,
 
# assume maintenance is happening and stop.
 
cd "$SITEDIR"
 
if [ "$(git_rev_name HEAD)" != "$PRODUCTION_BRANCH" ]; then
 
    exit 0
 
fi
 

	
 
# Abort if the production branch isn't tracking a remote branch.
 
if ! git_upstream="$(git_rev_name '@{upstream}' 2>/dev/null)"; then
 
    exit 3
 
fi
 

	
0 comments (0 inline, 0 general)