From f20864f42e76b46806786159101c9f4dd795fc50 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 6 Jun 2017 09:20:50 +0800 Subject: [PATCH] move cron to shell --- Procfile | 4 +--- updatessl.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Procfile b/Procfile index 14b25ad..b7346ac 100644 --- a/Procfile +++ b/Procfile @@ -1,4 +1,2 @@ dockergen: docker-gen -watch -notify "/app/updatessl.sh updatessl" /app/nginx.tmpl /etc/nginx/conf.d/default.conf -nginx: nginx -cron: cron && tail -f /dev/null - +nginx: nginx \ No newline at end of file diff --git a/updatessl.sh b/updatessl.sh index f939967..394b2f5 100755 --- a/updatessl.sh +++ b/updatessl.sh @@ -10,6 +10,15 @@ DEFAULT_CONF="/etc/nginx/conf.d/default.conf" CERTS="/etc/nginx/certs" +startcron() { + if service cron status | grep "cron is running"; then + echo "cron is running, skip" + else + service cron start + fi +} + + updatessl() { if grep ACME_DOMAINS $DEFAULT_CONF ; then @@ -33,6 +42,7 @@ updatessl() { } +startcron "$@"