summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-02-12 08:14:26 -0500
committerUnknwon <u@gogs.io>2016-02-12 08:14:26 -0500
commit1fa4fe706a7e2b7718f09db3b905c6d780c187db (patch)
tree178ba5334e7c9c0a3e10bffe51a666cf3b5cc3a0
parent600d8edaca56ac9b74bd73c3625c17875ecb848e (diff)
parentf4bc9263d97d55e811aeff383545fea7476105ba (diff)
downloadgitea-1fa4fe706a7e2b7718f09db3b905c6d780c187db.tar.gz
gitea-1fa4fe706a7e2b7718f09db3b905c6d780c187db.zip
Merge pull request #2605 from 0rax/develop
Add the ability to run crond inside the Docker container
-rw-r--r--docker/s6/crond/down0
-rwxr-xr-xdocker/s6/crond/run9
-rwxr-xr-xdocker/start.sh9
3 files changed, 18 insertions, 0 deletions
diff --git a/docker/s6/crond/down b/docker/s6/crond/down
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/docker/s6/crond/down
diff --git a/docker/s6/crond/run b/docker/s6/crond/run
new file mode 100755
index 0000000000..9aa9fb9f27
--- /dev/null
+++ b/docker/s6/crond/run
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Crontabs are located by default in /var/spool/cron/crontabs/
+# The default configuration is also calling all the scripts in /etc/periodic/${period}
+
+if test -f ./setup; then
+ source ./setup
+fi
+
+exec gosu root /usr/sbin/crond -fS
diff --git a/docker/start.sh b/docker/start.sh
index 042bdd05d5..a54c2a9bfd 100755
--- a/docker/start.sh
+++ b/docker/start.sh
@@ -48,6 +48,15 @@ else
create_socat_links
fi
+CROND=$(echo "$RUN_CROND" | tr '[:upper:]' '[:lower:]')
+if [ "$CROND" = "true" -o "$CROND" = "1" ]; then
+ echo "init:crond | Cron Daemon (crond) will be run as requested by s6" 1>&2
+ rm -f /app/gogs/docker/s6/crond/down
+else
+ # Tell s6 not to run the crond service
+ touch /app/gogs/docker/s6/crond/down
+fi
+
# Exec CMD or S6 by default if nothing present
if [ $# -gt 0 ];then
exec "$@"