Browse Source

Add the ability to run crond inside the Docker container

- Add the crond init script for s6
- Add the RUN_CROND configuration variable to setup crond
- Crond will not be run by default (hence the `down` file in the service directory)
- `start.sh` check if RUN_CROND = "true" || "1" and remove this file to tell s6 to run the initscript
- Resolves #2597
for-closed-social
Jean-Philippe Roemer 8 years ago
parent
commit
f4bc9263d9
3 changed files with 18 additions and 0 deletions
  1. +0
    -0
     
  2. +9
    -0
      docker/s6/crond/run
  3. +9
    -0
      docker/start.sh

+ 0
- 0
View File


+ 9
- 0
docker/s6/crond/run View File

@ -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

+ 9
- 0
docker/start.sh View File

@ -48,6 +48,15 @@ else
create_socat_links create_socat_links
fi 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 # Exec CMD or S6 by default if nothing present
if [ $# -gt 0 ];then if [ $# -gt 0 ];then
exec "$@" exec "$@"

Loading…
Cancel
Save