53 lines
3.2 KiB
JavaScript
53 lines
3.2 KiB
JavaScript
"use strict";
|
|
const plugins = require("./smartnginx.plugins");
|
|
let nginxChildProcess = undefined; // points to the nginx child process
|
|
/**
|
|
* starts nginx
|
|
*/
|
|
exports.start = (configArg) => {
|
|
let done = plugins.q.defer();
|
|
if (typeof nginxChildProcess == "undefined") {
|
|
nginxChildProcess = plugins.childProcess.exec("nginx", function (error, stdout, stderr) {
|
|
console.log(`stdout: ${stdout}`);
|
|
console.log(`stderr: ${stderr}`);
|
|
if (error !== null) {
|
|
console.log(`exec error: ${error}`);
|
|
}
|
|
});
|
|
}
|
|
;
|
|
plugins.beautylog.info("started Nginx!");
|
|
done.resolve();
|
|
return done.promise;
|
|
};
|
|
/**
|
|
* restarts nginx
|
|
*/
|
|
exports.restart = (configArg) => {
|
|
return exports.stop().then(() => {
|
|
return exports.start(configArg);
|
|
});
|
|
};
|
|
/**
|
|
* stops nginx
|
|
*/
|
|
exports.stop = () => {
|
|
let done = plugins.q.defer();
|
|
if (typeof nginxChildProcess != "undefined") {
|
|
nginxChildProcess.kill();
|
|
plugins.beautylog.info("stopped Nginx!");
|
|
}
|
|
else {
|
|
plugins.beautylog.log("nginx already stopped!");
|
|
}
|
|
;
|
|
done.resolve();
|
|
return done.promise;
|
|
};
|
|
/**
|
|
* checks if nginx is in path
|
|
*/
|
|
exports.check = () => {
|
|
return;
|
|
};
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jb21tYW5kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5jb21tYW5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLE9BQU8sV0FBTSxzQkFBc0IsQ0FBQyxDQUFBO0FBS2hELElBQUksaUJBQWlCLEdBQUcsU0FBUyxDQUFDLENBQUMsb0NBQW9DO0FBR3ZFOztHQUVHO0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