summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-06-25 20:40:27 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-06-25 20:40:27 +0200
commit0513dc1854cd80931e8627abe8fbbb09b7bbd171 (patch)
treecb039bdd12123bbdeb6496b11b7f3b38c8d7d281
parent71cab3986b9eb02c7b250a395701faae4b5c6b86 (diff)
Add the cronjob
-rwxr-xr-xcronjob.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/cronjob.sh b/cronjob.sh
new file mode 100755
index 0000000..f36be1c
--- /dev/null
+++ b/cronjob.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# This script gets run by a cronjob every minute. It pulls from the git server
+# and checks for changes. If any changes were made, we rebuild the site.
+
+PATH=$PATH:/usr/local/bin
+
+h1=`git rev-parse HEAD`
+git pull
+h2=`git rev-parse HEAD`
+
+[ $h1 = $h2 ] || {
+ make
+ ./build
+ git diff --name-only HEAD^ HEAD | grep -q server.go \
+ && systemctl restart euro-thomasvoss-com.service
+}