1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

rc: virtual_oss: Handle absent pidfile properly

Instead of throwing errors from the programs that use it, print a
warning if the file does not exist.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	0mp, jrm
Pull-Request:	https://ron-dev.freebsd.org/FreeBSD/src/pulls/33
This commit is contained in:
Christos Margiolis
2026-05-21 18:53:27 +02:00
parent 803f686938
commit b2677d002e
+11 -6
View File
@@ -76,12 +76,17 @@ stop_instance()
if [ -z "${instance_args}" ]; then if [ -z "${instance_args}" ]; then
warn "no such config: ${config}" warn "no such config: ${config}"
else else
pid="$(cat "${pidpath}/${config}.pid")" pidfile="${pidpath}/${config}.pid"
startmsg -n "Stopping virtual_oss config: ${config}: " if [ ! -f "${pidfile}" ]; then
kill "${pid}" warn "not running: ${config}"
pwait "${pid}" else
rm -f "${pidpath}/${config}.pid" pid="$(cat "${pidfile}")"
startmsg "done" startmsg -n "Stopping virtual_oss config: ${config}: "
kill "${pid}"
pwait "${pid}"
rm -f "${pidfile}"
startmsg "done"
fi
fi fi
} }