From 5ce9b0c04ee5b5e9dc5b2ae9b99a70a4857ae666 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Tue, 31 Aug 2021 06:18:52 +0000
Subject: [PATCH] added boilerplate for cronjob

---
 hugo-sync.sh |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/hugo-sync.sh b/hugo-sync.sh
index 5e31bad..911a44b 100755
--- a/hugo-sync.sh
+++ b/hugo-sync.sh
@@ -1,3 +1,5 @@
+#!/bin/sh
+
 REPO_DIR=$HOME/sites
 SITE_DIR=repo
 DEPLOY_DIR=/Eduardo/repo
@@ -5,14 +7,14 @@
 cd $REPO_DIR/$SITE_DIR
 
 # Check for repo update
-if [[ -n $(git pull | grep 'Already up to date.') ]]; then
-#	exit
-	echo 1
+if [ -n "$(git pull --ff-only | grep 'Already up to date.')" ]; then
+	exit
 fi
+echo "Updating $SITE_DIR site"
 
 # Build site
-hugo
+hugo 2>&1 >/dev/null
 
 # sync new files across
-rsync -av public/* $DEPLOY_DIR/
+rsync -a public/* $DEPLOY_DIR/
 

--
Gitblit v1.9.3