rlgwebd/rlgwebd-stop
John "Elwin" Edwards c4d10ba33d rlgwebd-stop: avoid the deprecated domain module.
Instead of catching connection errors with domains, install an error
listener on the socket before connecting.
2017-01-27 19:18:31 -05:00

19 lines
448 B
JavaScript
Executable file

#!/usr/bin/env node
var net = require('net');
var sockpath = "/var/run/rlgwebd.sock";
var sock = new net.Socket();
sock.on('error', function (err) {
console.log("Cannot connect to " + sockpath + ", rlgwebd already stopped.");
process.exit(0);
});
sock.connect(sockpath, function () {
sock.on('close', function (had_error) {
if (process.argv[2] == "debug")
console.log("Control socket closed");
});
sock.write("quit\n");
});