TT#41051 Fix shellcheck warning for Red Hat init scripts

* warning: cachefile appears unused. Verify it or export it. [SC2034]
* warning: Double quote to prevent globbing and word splitting. [SC2086]
* removed unnecessary space

Change-Id: I71276ca08d1a5599bf1034403d2973ef78d8079e
changes/40/22640/1
Alexander Lutay 7 years ago
parent 1a8dc4aada
commit bc9f09cdf5

@ -31,7 +31,7 @@ prog=rtpengine-recording
runfile=/usr/sbin/${prog}
pidfile=${PIDFILE-/var/run/rtpengine-recording.pid}
lockfile=${LOCKFILE-/var/lock/subsys/rtpengine-recording}
cachefile=/var/lib/ngcp-rtpengine/$prog.cfg
RETVAL=0
OPTS=""

@ -48,19 +48,19 @@ build_opts() {
fi
else
# configfile exists?
if [ ! -f $configfile ];then
if [ ! -f "$configfile" ];then
echo "Error: $configfile not present"
exit -1
fi
# get table variable from config
table="$(grep -Ei '^table' $configfile|cut -d\ -f3)"
if [ -z $table ];then
table="$(grep -Ei '^table' $configfile|cut -d= -f3)"
table="$(grep -Ei '^table' "$configfile" | cut -d\ -f3)"
if [ -z "$table" ];then
table="$(grep -Ei '^table' "$configfile" | cut -d= -f3)"
fi
# error if directive is not presented in config
if [ -z $table ];then
if [ -z "$table" ];then
echo "Error: directive table= is not present in $configfile"
exit -1
fi
@ -79,9 +79,9 @@ build_opts() {
fi
# options
[[ "$FORK" == "no" ]] && OPTS+=" --foreground"
[[ "$LOG_STDERR" == "yes" ]] && OPTS+=" --log-stderr"
[[ "$FALLBACK" != "yes" ]] && OPTS+=" --no-fallback"
[[ "$FORK" == "no" ]] && OPTS+=" --foreground"
[[ "$LOG_STDERR" == "yes" ]] && OPTS+=" --log-stderr"
[[ "$FALLBACK" != "yes" ]] && OPTS+=" --no-fallback"
[ -z "$CONFIG_FILE" ] || OPTS+=" --config-file=$CONFIG_FILE"
[ -z "$CONFIG_SECTION" ] || OPTS+=" --config-section=$CONFIG_SECTION"
[ -z "$ADDRESS" ] || OPTS+=" --interface=$ADDRESS"

Loading…
Cancel
Save