view rlgwebd-stop @ 204:a200b313870d

Use either HTTP or HTTPS. If HTTPS is enabled, RLGWebD will not use insecure HTTP.
author John "Elwin" Edwards
date Sun, 08 Jan 2017 16:17:11 -0500
parents a7cc38a0168d
children ffe22d88bea1
line wrap: on
line source

#!/usr/bin/env node

var net = require('net');
var domain = require('domain');
var sockpath = "/var/run/rlgwebd.sock";

var dom = domain.create();

dom.on('error', function (err) {
  console.log("Cannot connect to " + sockpath + ", rlgwebd already stopped.");
  process.exit(0);
});

dom.run(function () {
  var sock = net.connect(sockpath, function () {
    sock.on('close', function () {
      if (process.argv[2] == "debug")
        console.log("Control socket closed");
    });
    sock.write("quit\n");
  });
});