Merge "Fixed Shellcheck's warnings in murano-agent"
This commit is contained in:
commit
1f81e6e17b
@ -18,24 +18,24 @@ PIDFILE=/var/run/murano.pid
|
|||||||
LOGFILE=/var/log/murano.log
|
LOGFILE=/var/log/murano.log
|
||||||
|
|
||||||
start() {
|
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
|
echo 'Service already running' >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo 'Starting service' >&2
|
echo 'Starting service' >&2
|
||||||
PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH"
|
PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH"
|
||||||
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
|
LOCAL_CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
|
||||||
su -c "$CMD" $RUNAS > "$PIDFILE"
|
su -c "$LOCAL_CMD" $RUNAS > "$PIDFILE"
|
||||||
echo 'Service started' >&2
|
echo 'Service started' >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
|
if [ ! -f "$PIDFILE" ] || ! kill -0 "$(cat "$PIDFILE")"; then
|
||||||
echo 'Service not running' >&2
|
echo 'Service not running' >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo 'Stopping service' >&2
|
echo 'Stopping service' >&2
|
||||||
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
|
kill -15 "$(cat "$PIDFILE")" && rm -f "$PIDFILE"
|
||||||
echo 'Service stopped' >&2
|
echo 'Service stopped' >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,4 +52,4 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start|stop|restart|uninstall}"
|
echo "Usage: $0 {start|stop|restart|uninstall}"
|
||||||
esac
|
esac
|
Loading…
Reference in New Issue
Block a user