-
-
Save martinrusev/7015e393d46647dbad15 to your computer and use it in GitHub Desktop.
[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"] |
Hi,
Can you please explain what are -f & -L options, as I cannot find this in cron's help
[program:cron]
command = cron -f -L 15
Regards,
Kavya K
$ man cron | cat
CRON(8) System Manager's Manual CRON(8)
NAME
cron - daemon to execute scheduled commands (Vixie Cron)
SYNOPSIS
cron [-f] [-l] [-L loglevel]
DESCRIPTION
cron is started automatically from /etc/init.d on entering multi-user runlevels.
OPTIONS
-f Stay in foreground mode, don't daemonize.
-l Enable LSB compliant names for /etc/cron.d files. This setting, however, does not affect the parsing
of files under /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly or /etc/cron.monthly.
-n Include the FQDN in the subject when sending mails. By default, cron will abbreviate the hostname.
-L loglevel
Tell cron what to log about jobs (errors are logged regardless of this value) as the sum of the fol‐
lowing values:
1 will log the start of all cron jobs
2 will log the end of all cron jobs
4 will log all failed jobs (exit status != 0)
8 will log the process number of all cron jobs
The default is to log the start of all jobs (1). Logging will be disabled if levels is set to zero
(0). A value of fifteen (15) will select all options.
Great, thks, it hep me a lot. Already have my cron working.... but would like to understand.....Why can not crond be daemonized ?
If you daemonize cron, supervisord will take that as an exit and repeatedly try to "restart" the process.
@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.
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?
@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?
can I use this to start my apache2 after the cron start ? I tested and my apache works but cron runs as a daemon but my actual cron jobs are not invoking.