Using the /etc/crontabs/root file

This commit is contained in:
Corey Gaspard
2017-07-19 10:00:17 -05:00
parent f36bdea017
commit acc9016d39
3 changed files with 9 additions and 5 deletions

View File

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