Browse Source

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
pull/698/head
Michael Prokop 7 years ago
parent
commit
b5c350beb9
2 changed files with 8 additions and 8 deletions
  1. +2
    -2
      el/rtpengine-recording.init
  2. +6
    -6
      el/rtpengine.init

+ 2
- 2
el/rtpengine-recording.init View File

@ -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


+ 6
- 6
el/rtpengine.init View File

@ -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


Loading…
Cancel
Save