Using the /etc/crontabs/root file
parent
f36bdea017
commit
acc9016d39
|
@ -1,7 +1,7 @@
|
|||
# docker run -d -p 8000:8000 alseambusher/crontab-ui
|
||||
FROM alpine:3.5
|
||||
|
||||
RUN mkdir /crontab-ui
|
||||
RUN mkdir /crontab-ui; touch /etc/crontabs/root; chmod +x /etc/crontabs/root
|
||||
|
||||
WORKDIR /crontab-ui
|
||||
|
||||
|
@ -23,7 +23,7 @@ ENV HOST 0.0.0.0
|
|||
|
||||
ENV PORT 8000
|
||||
|
||||
ENV CRON_PATH /crontab-ui/crontabs/
|
||||
ENV CRON_PATH /etc/crontabs
|
||||
ENV CRON_IN_DOCKER true
|
||||
|
||||
EXPOSE $PORT
|
||||
|
|
|
@ -115,8 +115,12 @@ exports.set_crontab = function(env_vars, callback){
|
|||
|
||||
fs.writeFile(exports.env_file, env_vars, function(err) {
|
||||
if (err) callback(err);
|
||||
|
||||
fs.writeFile(path.join(cronPath, "crontab"), crontab_string, function(err) {
|
||||
// In docker we're running as the root user, so we need to write the file as root and not crontab
|
||||
var fileName = "crontab"
|
||||
if(process.env.CRON_IN_DOCKER !== undefined) {
|
||||
fileName = "root"
|
||||
}
|
||||
fs.writeFile(path.join(cronPath, fileName), crontab_string, function(err) {
|
||||
if (err) return callback(err);
|
||||
/// In docker we're running crond using busybox implementation of crond
|
||||
/// It is launched as part of the container startup process, so no need to run it again
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
nodaemon=true
|
||||
|
||||
[program:crontab]
|
||||
command=crond -l 2 -f -c %(CRON_PATH)s
|
||||
command=crond -l 2 -f -c %(ENV_CRON_PATH)s
|
||||
stderr_logfile = /var/log/crontab-stderr.log
|
||||
stdout_logfile = /var/log/crontab-stdout.log
|
||||
|
||||
|
|
Loading…
Reference in New Issue