From aaf60463a0c5cfa5b333e34629f026c05f6a4904 Mon Sep 17 00:00:00 2001 From: Jakob Kartschall Date: Thu, 12 Nov 2020 18:24:38 +0100 Subject: [PATCH] fix sysv init scripts --- spec/defines/daemon_spec.rb | 2 +- spec/fixtures/files/prometheus1.sysv | 4 ++-- spec/fixtures/files/prometheus2.sysv | 4 ++-- templates/daemon.sysv.erb | 2 +- templates/prometheus.sysv.erb | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/defines/daemon_spec.rb b/spec/defines/daemon_spec.rb index 9f6fd62bd..1916e444d 100644 --- a/spec/defines/daemon_spec.rb +++ b/spec/defines/daemon_spec.rb @@ -101,7 +101,7 @@ 'owner' => 'root', 'group' => 'root' ).with_content( - %r{daemon --user=smurf_user \\\n --pidfile="\$PID_FILE" \\\n "\$DAEMON" '' >> "\$LOG_FILE" 2>&1 &} + %r{daemon --user=smurf_user \\\n --pidfile="\$PID_FILE" \\\n "'\$DAEMON' '' >> '\$LOG_FILE' 2>&1 &"} ) } diff --git a/spec/fixtures/files/prometheus1.sysv b/spec/fixtures/files/prometheus1.sysv index d7f1cb793..434e328be 100644 --- a/spec/fixtures/files/prometheus1.sysv +++ b/spec/fixtures/files/prometheus1.sysv @@ -51,12 +51,12 @@ start() { [ -f $PID_FILE ] && rm $PID_FILE daemon --user=prometheus \ --pidfile="$PID_FILE" \ - "$DAEMON" -log.format logger:stdout -config.file=/etc/prometheus/prometheus.yaml \ + "'$DAEMON' -log.format logger:stdout -config.file=/etc/prometheus/prometheus.yaml \ -web.console.templates=/usr/local/share/prometheus/consoles \ -web.console.libraries=/usr/local/share/prometheus/console_libraries \ -storage.local.path=/var/lib/prometheus \ -storage.local.retention=360h \ - >> "$LOG_FILE" & + >> '$LOG_FILE' 2>&1 &" retcode=$? mkpidfile touch /var/lock/subsys/prometheus diff --git a/spec/fixtures/files/prometheus2.sysv b/spec/fixtures/files/prometheus2.sysv index 675d2c32c..2820fb1dd 100644 --- a/spec/fixtures/files/prometheus2.sysv +++ b/spec/fixtures/files/prometheus2.sysv @@ -51,12 +51,12 @@ start() { [ -f $PID_FILE ] && rm $PID_FILE daemon --user=prometheus \ --pidfile="$PID_FILE" \ - "$DAEMON" --config.file=/etc/prometheus/prometheus.yaml \ + "'$DAEMON' --config.file=/etc/prometheus/prometheus.yaml \ --web.console.templates=/usr/local/share/prometheus/consoles \ --web.console.libraries=/usr/local/share/prometheus/console_libraries \ --storage.tsdb.path=/var/lib/prometheus \ --storage.tsdb.retention=360h \ - >> "$LOG_FILE" & + >> '$LOG_FILE' 2>&1 &" retcode=$? mkpidfile touch /var/lock/subsys/prometheus diff --git a/templates/daemon.sysv.erb b/templates/daemon.sysv.erb index d2bd546c2..ed1483834 100644 --- a/templates/daemon.sysv.erb +++ b/templates/daemon.sysv.erb @@ -52,7 +52,7 @@ start() { daemon --user=<%= @user %> \ --pidfile="$PID_FILE" \ <%- require 'shellwords' -%> - "$DAEMON" <%= Shellwords.escape(@options) %> >> "$LOG_FILE" 2>&1 & + "'$DAEMON' <%= Shellwords.escape(@options) %> >> '$LOG_FILE' 2>&1 &" retcode=$? sleep 1 mkpidfile diff --git a/templates/prometheus.sysv.erb b/templates/prometheus.sysv.erb index dab51691d..0be777798 100644 --- a/templates/prometheus.sysv.erb +++ b/templates/prometheus.sysv.erb @@ -51,8 +51,8 @@ start() { [ -f $PID_FILE ] && rm $PID_FILE daemon --user=<%= scope.lookupvar('prometheus::server::user') %> \ --pidfile="$PID_FILE" \ - "$DAEMON" <%= @daemon_flags.join(" \\\n ") %> \ - >> "$LOG_FILE" & + "'$DAEMON' <%= @daemon_flags.join(" \\\n ") %> \ + >> '$LOG_FILE' 2>&1 &" retcode=$? mkpidfile touch /var/lock/subsys/prometheus