From b5c350beb963775c9b19d4a5df8ea74fd9e54733 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 31 Jan 2019 14:25:59 +0100 Subject: [PATCH] el init scripts: send errors to stderr and exit with proper return code `exit -1` is out of range in shell scripts and returning with 255, while init scripts are supposed to be exit with `1` and similar on errors. We're following http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/iniscrptact.html and returning with exit code 6 for configuration issues. Change-Id: I8eda8e059c4ea10b9ddbddd1306627894073b034 --- el/rtpengine-recording.init | 4 ++-- el/rtpengine.init | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/el/rtpengine-recording.init b/el/rtpengine-recording.init index 1dc3299db..db536127f 100644 --- a/el/rtpengine-recording.init +++ b/el/rtpengine-recording.init @@ -23,8 +23,8 @@ if [ -f /etc/sysconfig/rtpengine-recording ] then . /etc/sysconfig/rtpengine-recording else - echo "Error: /etc/sysconfig/rtpengine-recording not present" - exit -1 + echo "Error: /etc/sysconfig/rtpengine-recording not present" >&2 + exit 6 fi prog=rtpengine-recording diff --git a/el/rtpengine.init b/el/rtpengine.init index c337b22b0..147f4fd69 100644 --- a/el/rtpengine.init +++ b/el/rtpengine.init @@ -26,8 +26,8 @@ if [ -f /etc/sysconfig/rtpengine ] then . /etc/sysconfig/rtpengine else - echo "Error: /etc/sysconfig/rtpengine not present" - exit -1 + echo "Error: /etc/sysconfig/rtpengine not present" >&2 + exit 6 fi rtpengine=/usr/sbin/rtpengine @@ -52,8 +52,8 @@ build_opts() { else # configfile exists? if [ ! -f "$configfile" ];then - echo "Error: $configfile not present" - exit -1 + echo "Error: $configfile not present" >&2 + exit 6 fi # get table variable from config @@ -64,8 +64,8 @@ build_opts() { # error if directive is not presented in config if [ -z "$table" ];then - echo "Error: directive table= is not present in $configfile" - exit -1 + echo "Error: directive table= is not present in $configfile" >&2 + exit 6 fi # enable iptables module if derective set and positive