satan.status(watcher_opts.key, function(err, running) { if (running) return cb(new Error("Prey Owl Monitor it's already running :)")); satan.ensure_created(watcher_opts, function(err) { if (err) return cb(err); // wait one sec, then start. or half. setTimeout(function() { satan.start(watcher_opts.key, cb); }, 500); }); });
var next = function(err) { // EBUSY error is when file is being run. that shouldn't happen normally // but for the purposes of setting up the daemon, it doesn't really matter. if (err && err.code !== 'EBUSY') return cb(err); // satan ensures the daemon is destroyed before creating // a new one, so there's no need to perform that check now. satan.ensure_created(daemon_opts, function(err) { if (err) return cb(err); // wait one sec, then start. or half. setTimeout(function() { satan.start(daemon_opts.key, cb); }, 500); }); }