view rlgwebd-stop @ 210:b04313038a0b

Changes for compatibility with recent versions of NodeJS. The pty.js module is replaced with node-pty, now-mandatory callbacks are added to various fs functions, and deprecated Buffer() calls are replaced with Buffer.from() or Buffer.alloc().
author John "Elwin" Edwards
date Sun, 25 Aug 2019 21:27:31 -0400
parents f06f2d1a5035
children
line wrap: on
line source

#!/usr/bin/env node

var net = require('net');
var sockpath = "/var/run/rlgwebd/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");
});