Add dedicated cronjob file for keeping the project in sync on docker containers.

This commit is contained in:
2025-10-14 11:18:39 -07:00
parent 8207702442
commit 8507cbd189

23
cronjob.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# 2025-10-14 Hyperling
# Copied cronjob.sh from env-docker/Config/Hugo-Example/files/ to use for this
# project so that docker container can do periodic git pulls rather than having
# to reload /rebuild the container each time a release is pushed out.
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
echo "$DIR/$PROG"
cd $DIR
echo "*** Running cronjob @ `date` ***"
# Pull any updates, and if the project is already up to date, exit successfully.
git pull | grep -v "up to date"
status="$?"
echo "* Pull status is '$status'."
if [[ $status != 0 ]]; then
echo "* Site is already up to date, exiting."
exit 0
fi
exit 0