Merge "Fixed Shellcheck's warnings in murano-agent"

This commit is contained in:
Jenkins 2016-10-21 06:07:52 +00:00 committed by Gerrit Code Review
commit 1f81e6e17b

View File

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