3
+
# this post-recieve hook runs globally on my local git machine
4
+
# it checks for the precense of a knot.conf file
5
+
# if the file exists it reads it to get the remote repo and mirror pushes
9
+
KNOT_FILE="$REPO_PATH/knot.conf"
10
+
LOGFILE="/var/log/knot-sync.log" #log our syncing isssues
12
+
if [ ! -f "$KNOT_FILE" ]; then
15
+
REPO_URL=$(cat "$KNOT_FILE" | tr -d '\n' | xargs)
16
+
if [ -z "$REPO_URL" ]; then
17
+
echo "[$(date)] $REPO_PATH: misconfigured knot.conf, skipping", >> "$LOGFILE"
22
+
git push --mirror "$REPO_URL" >> "$LOGFILE" 2>&1
25
+
# make sure the sync occurs in the background
26
+
nohup bash -c "sync_repo" > /dev/null 2>&1 &