From ace26c5db35a92370de7fb22c93e9a3fb15513e2 Mon Sep 17 00:00:00 2001 From: Artem Tiumentcev Date: Wed, 21 Sep 2016 23:21:42 +0300 Subject: [PATCH] Fixed Shellcheck's warnings in murano-agent Shellcheck complains like this: meta/io.murano/Resources/murano-agent|26 col 3 warning| In POSIX sh, 'local' is undefined. [SC2039] [sh/shellcheck] And add quotes to prevent word splitting. Change-Id: I99a296ebc33a101bcd0e4f9d824d3f217ec7c438 Closes-Bug: #1622384 --- meta/io.murano/Resources/murano-agent | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meta/io.murano/Resources/murano-agent b/meta/io.murano/Resources/murano-agent index 476699e4..0bb3a233 100644 --- a/meta/io.murano/Resources/murano-agent +++ b/meta/io.murano/Resources/murano-agent @@ -18,24 +18,24 @@ PIDFILE=/var/run/murano.pid LOGFILE=/var/log/murano.log start() { - if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then + if [ -f /var/run/"$PIDNAME" ] && kill -0 "$(cat /var/run/"$PIDNAME")"; then echo 'Service already running' >&2 return 1 fi echo 'Starting service' >&2 PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH" - local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" - su -c "$CMD" $RUNAS > "$PIDFILE" + LOCAL_CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" + su -c "$LOCAL_CMD" $RUNAS > "$PIDFILE" echo 'Service started' >&2 } stop() { - if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then + if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")"; then echo 'Service not running' >&2 return 1 fi echo 'Stopping service' >&2 - kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" + kill -15 "$(cat "$PIDFILE")" && rm -f "$PIDFILE" echo 'Service stopped' >&2 } @@ -52,4 +52,4 @@ case "$1" in ;; *) echo "Usage: $0 {start|stop|restart|uninstall}" -esac +esac \ No newline at end of file