Actually restart RLGWebD if it crashes.
Also, rlgwebd-stop will no longer crash if RLGWebD has already stopped.
This commit is contained in:
parent
ba487995e0
commit
2baaad79dd
2 changed files with 17 additions and 6 deletions
22
rlgwebd-stop
22
rlgwebd-stop
|
|
@ -1,12 +1,22 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
var net = require('net');
|
||||
var domain = require('domain');
|
||||
var sockpath = "/var/run/rlgwebd.sock";
|
||||
|
||||
var sock = net.connect(sockpath, function () {
|
||||
sock.on('close', function () {
|
||||
if (process.argv[2] == "debug")
|
||||
console.log("Control socket closed");
|
||||
});
|
||||
sock.write("quit\n");
|
||||
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");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Type=simple
|
|||
Environment=NODE_PATH=/usr/lib/node_modules
|
||||
ExecStart=/usr/local/bin/rlgwebd
|
||||
ExecStop=/usr/local/bin/rlgwebd-stop
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue