Skip to content

Instantly share code, notes, and snippets.

@martinrusev
Last active June 1, 2024 03:27
Show Gist options
  • Save martinrusev/7015e393d46647dbad15 to your computer and use it in GitHub Desktop.
Save martinrusev/7015e393d46647dbad15 to your computer and use it in GitHub Desktop.
Cron supervisord
[supervisord]
nodaemon=true
loglevel=debug
[program:amon]
command=gunicorn -c gunicorn.conf.py wsgi
directory=/amon
autostart=true
autorestart=true
redirect_stderr=true
stopsignal = QUIT
[program:cron]
command = cron -f -L 15
autostart=true
autorestart=true
FROM martinrusev/amon:latest
COPY requirements.txt /var/requirements.txt
RUN pip install -r /var/requirements.txt
COPY crontab.txt /var/crontab.txt
RUN crontab /var/crontab.txt
RUN chmod 600 /etc/crontab
COPY supervisord.conf /etc/supervisord.conf
EXPOSE 8000
CMD ["/usr/local/bin/supervisord"]
@agorostidi
Copy link

Great, thks, it hep me a lot. Already have my cron working.... but would like to understand.....Why can not crond be daemonized ?

@davehenke
Copy link

If you daemonize cron, supervisord will take that as an exit and repeatedly try to "restart" the process.

@medmin
Copy link

medmin commented Aug 9, 2017

@agorostidi as far as I know, supervisord only manages non-daemon processes. For example, if you want to use supervisord to manage Nginx, you have to modify the nginx configuration, and turn off the daemon option.

@gerroon
Copy link

gerroon commented Jun 24, 2018

But in this example supervisord will be running and not giving me a shell when I satrt the docker image, I also want the shell and want supervisord to run in the bg?

@grerrg
Copy link

grerrg commented Sep 3, 2018

@gerroon if you need a shell in your container, i presume to make changes, you can run docker exec -ti <repo> sh. Or do you want supervisor to spawn a shell for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment