浏览代码

web: prevent s6 from restarting cron if it shouldn't be run

mammo0 4 年之前
父节点
当前提交
ba011900fb
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      web/rootfs/etc/services.d/cron/run

+ 7 - 4
web/rootfs/etc/services.d/cron/run

@@ -1,7 +1,10 @@
 #!/usr/bin/with-contenv bash
 
-if [[ $DISABLE_HTTPS -ne 1 ]]; then
-    if [[ $ENABLE_LETSENCRYPT -eq 1 ]]; then
-      exec cron -f
-    fi
+if [[ $DISABLE_HTTPS -ne 1 ]] && \
+   [[ $ENABLE_LETSENCRYPT -eq 1 ]]; then
+    exec cron -f
+else
+    # if cron should not be started,
+    # prevent s6 from restarting this script again and again
+    s6-svc -O /var/run/s6/services/cron
 fi