Skip to content

Commit

Permalink
optional param 'reason' to systemRestart
Browse files Browse the repository at this point in the history
  • Loading branch information
miopa committed May 11, 2017
1 parent 3d54b74 commit 58eb548
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,32 @@ exports.restartAsterisk = function (params, reply) {
};
*/

var resetDongle = function (dongleName, reason) {
ami.command("dongle reset " + dongleName);
if (reason) {
exports.systemRestart = function (params, reply) {
myLib.sysExec("/usr/bin/sudo", ["/usr/bin/shutdown", "-r", "now"], (err, output) => {
reply(err ? 503 : 200, output);
});
if (params.reason) {
myLib.jsonLog({
name: dongleName,
reason: reason,
}, ["telegraf", "notice"], ["bulletproof"], { modemResetRequests: {
}, ["telegraf", "notice"], ["bulletproof"], { systemRestartRequests: {
value: 1
}});
}
};

exports.systemRestart = function (params, reply) {
myLib.sysExec("/usr/bin/sudo", ["/usr/bin/shutdown", "-r", "now"], (err, output) => {
reply(err ? 503 : 200, output);
});
};

exports.resetModems = function (params, reply) {
var resetDongle = function (dongleName, reason) {
ami.command("dongle reset " + dongleName);
if (reason) {
myLib.jsonLog({
name: dongleName,
reason: reason,
}, ["telegraf", "notice"], ["bulletproof"], { modemResetRequests: {
value: 1
}});
}
};

if (params.name) {
if (s.ui.mixer.channels[params.name] && s.ui.mixer.channels[params.name].mode !== 'defunct') {
reply(200, '');
Expand Down

0 comments on commit 58eb548

Please sign in to comment.