From 77b2fd90a24fd737528fa5a2da8f141a1a6b0d71 Mon Sep 17 00:00:00 2001 From: Andras Kerekes Date: Mon, 2 Feb 2015 12:24:48 -0500 Subject: [PATCH] redirect stderr to syslog and do some cosmetical changes --- templates/default/consul-init.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/templates/default/consul-init.erb b/templates/default/consul-init.erb index 2bbe1ea0..f5510ea3 100644 --- a/templates/default/consul-init.erb +++ b/templates/default/consul-init.erb @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ### BEGIN INIT INFO # Provides: consul # Required-Start: $network $remote_fs $syslog @@ -40,7 +40,8 @@ case "$1" in echo "$NAME already running" else echo "Starting $NAME" - $CMD >> "$LOGFILE" & + exec 2> >(while IFS= read -r line; do logger -t consul "$line"; done) + "${CMD[@]}" >> "$LOGFILE" & echo $! > "$PIDFILE" if ! is_running; then echo "Unable to start $NAME, see $LOGFILE"