28 lines
676 B
JavaScript
28 lines
676 B
JavaScript
/**
|
|
* ConfigController
|
|
*
|
|
* @description :: Server-side logic for managing configs
|
|
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
|
|
*/
|
|
|
|
module.exports = {
|
|
|
|
restartLogger: function(req, res){
|
|
var exec = require('child_process').exec;
|
|
exec('/etc/init.d/tagserver start', function(error, stdout, stderr){
|
|
if (error) return res.serverError(error);
|
|
res.ok();
|
|
});
|
|
},
|
|
|
|
checkLoggerStatus: function(req, res){
|
|
var fs = require('fs');
|
|
var isRunning = require('is-running');
|
|
fs.readFile('/root/tagserver.pid', function(err, data){
|
|
if (err) return res.serverError(err);
|
|
res.ok({pid:data, status:isRunning(data)});
|
|
});
|
|
}
|
|
|
|
};
|