From 16799123ecbeab2c9ee53e4249a66b44ae82aa3d Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 22 Jul 2019 17:58:28 -0700 Subject: [PATCH] Added crash restart support for non Upstart Init services --- agents/meshinstall-initd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/agents/meshinstall-initd.sh b/agents/meshinstall-initd.sh index 58f05148..5d5f88ac 100644 --- a/agents/meshinstall-initd.sh +++ b/agents/meshinstall-initd.sh @@ -20,7 +20,8 @@ start() { return 1 fi echo 'Starting serviceā€¦' >&2 - local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" + local CMD="$SCRIPT -exec \"var child; process.on('SIGTERM', function () { child.removeAllListeners('exit'); child.kill(); process.exit(); }); function start() { child = require('child_process').execFile(process.execPath, [process.argv0, \"\"]); child.stdout.on('data', function (c) { }); child.stderr.on('data', function (c) { }); child.on('exit', function (status) { start(); }); } start();\" &> \"$LOGFILE\" & echo \$!" + cd /usr/local/mesh su -c "$CMD" $RUNAS > "$PIDFILE" echo 'Service started' >&2