Browse Source

added delay option to processes

master
mortie 8 years ago
parent
commit
6660e6ddce
3 changed files with 18 additions and 3 deletions
  1. 1
    1
      dedaemon.js
  2. 1
    0
      js/parse-conf.js
  3. 16
    2
      modules/process/index.js

+ 1
- 1
dedaemon.js View File

}; };


if (!process.argv[2]) { if (!process.argv[2]) {
console.log("Usage:", process.argv[1], "<config>");
console.error("Usage:", process.argv[1], "<config>");
process.exit(1); process.exit(1);
} }



+ 1
- 0
js/parse-conf.js View File

env: [ "object", "null" ], env: [ "object", "null" ],
restart: "bool", restart: "bool",
as: [ "string", "null" ], as: [ "string", "null" ],
delay: [ "number", "null" ],
}, },
}, },
} }

+ 16
- 2
modules/process/index.js View File

this.child.kill("SIGKILL"); this.child.kill("SIGKILL");
} }


this.stopping = false;
cb(); cb();
}, 1000); }, 1000);
} }
} }


stop(cb) { stop(cb) {
var next = async(this.procs.length, cb);
this.stopping = true;
var next = async(this.procs.length, () => {
this.stopping = false;
cb();
});
this.procs.forEach(p => p.stop(next)); this.procs.forEach(p => p.stop(next));
} }
} }
"Invalid 'as' attribute:", "Invalid 'as' attribute:",
proc.as); proc.as);
} }
p.start();
procs[proc.name] = p; procs[proc.name] = p;

if (proc.delay != null) {
setTimeout(() => {
if (!p.stopping)
p.start();
}, proc.delay);
} else {
p.start();
}
}); });
} }



Loading…
Cancel
Save