changeset 193:80ca029f0906

Add a script to stop RLGWebD. socat is no longer needed, nor is preventing systemd from sending signals.
author John "Elwin" Edwards
date Sat, 02 Jan 2016 14:33:48 -0500
parents addc4e3456c4
children 5483d413a45b
files Makefile rlgwebd-stop.js rlgwebd.service
diffstat 3 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jan 01 16:11:34 2016 -0500
+++ b/Makefile	Sat Jan 02 14:33:48 2016 -0500
@@ -1,4 +1,5 @@
 CHROOT=/var/dgl
+BINDIR=/usr/local/bin
 
 WEBASSETS = about.html bell.svg index.html options.html options.js rlgterm.js \
             style-rlg.css termemu.js termemu-keys.js tty.css
@@ -18,7 +19,7 @@
 	mkdir -p ${CHROOT}/bin
 	cp sqlickrypt dglwatcher ${CHROOT}/bin
 	for LIB in `ldd ./sqlickrypt | awk '$$1 ~ "^/" {print $$1}; $$3 ~ "^/" {print $$3}'`; do mkdir -p ${CHROOT}`dirname $$LIB`; cp $$LIB ${CHROOT}$$LIB; done
-	cp rlgwebd.js /usr/local/bin/rlgwebd.js
+	cp rlgwebd.js rlgwebd-stop.js ${BINDIR}
 	mkdir -p /var/local/rlgwebd
 	cp ${WEBASSETS} ${CHROOT}/var/www
 	cp rlgwebd.service /usr/lib/systemd/system
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rlgwebd-stop.js	Sat Jan 02 14:33:48 2016 -0500
@@ -0,0 +1,12 @@
+#!/usr/bin/env node
+
+var net = require('net');
+var sockpath = "/var/local/rlgwebd/ctl";
+
+var sock = net.connect(sockpath, function () {
+  sock.on('close', function () {
+    if (process.argv[2] == "debug")
+      console.log("Control socket closed");
+  });
+  sock.write("quit\n");
+});
--- a/rlgwebd.service	Fri Jan 01 16:11:34 2016 -0500
+++ b/rlgwebd.service	Sat Jan 02 14:33:48 2016 -0500
@@ -6,8 +6,7 @@
 Type=simple
 Environment=NODE_PATH=/usr/lib/node_modules
 ExecStart=/usr/bin/node /usr/local/bin/rlgwebd.js
-ExecStop=/usr/bin/socat "EXEC:echo quit" /var/local/rlgwebd/ctl
-KillMode=none
+ExecStop=/usr/bin/node /usr/local/bin/rlgwebd-stop.js
 
 [Install]
 WantedBy=multi-user.target