From 1152dba69fd86bd1cab2752927c6cff439d90a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Wed, 14 Feb 2024 14:51:24 +0200 Subject: [PATCH] Add updater during install. --- install.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/install.sh b/install.sh index d524e1e6..e01a9762 100644 --- a/install.sh +++ b/install.sh @@ -136,6 +136,25 @@ server { EOF fi # plebeian-market-nginx/app.conf +if [ ! -f update.sh ]; then + cat << EOF > update.sh +#!/bin/sh + +cd + +if [ ! -f plebeian-market-state/UPDATE_REQUESTED ]; then + # TODO: we could have a command line argument to force update, so this script would be usable on its own! + echo "Update not requested. Exiting..." + exit 0 +fi + +rm plebeian-market-state/UPDATE_REQUESTED + +docker compose down --volumes && docker compose pull && docker compose up -d +EOF + crontab -l | { cat; echo "* * * * * /bin/sh /root/update.sh"; } | crontab - +fi # update.sh + if [ ! -f docker-compose.yml ]; then cat << EOF > docker-compose.yml version: '3.6'