Fix spew on stopping a dead service

This commit is contained in:
Salt 2020-11-04 21:11:04 -06:00
parent 5abed1f219
commit bcf9c80efb

View File

@ -132,7 +132,10 @@ fsstop() {
# Stop a running service by name
for service in $@; do
pidfile="$_optrundir"/"$service".pid
[ -f "$pidfile" ] || warn "Service is not already running: $service"
if ! [ -f "$pidfile" ]; then
warn "Service is not already running: $service"
continue
fi
pid="$(< $pidfile)"
[ "$pid" -gt 0 ] 2> /dev/null || error "PID is invalid for service: $service (PID $pid)" 51
[ -d "/proc/$pid" ] || warn "Service is already dead: $service"