Merge "Fix Ceph processes PID management control"

This commit is contained in:
Zuul
2025-01-22 20:11:27 +00:00
committed by Gerrit Code Review

View File

@@ -737,12 +737,12 @@ daemon_is_running() {
daemon_id=$3 daemon_id=$3
pidfile=$4 pidfile=$4
do_cmd "if [ ! -e $pidfile ] ; then do_cmd "if [ ! -e $pidfile ] ; then
pid_found=\$(ps aux | grep \"$daemon -i $daemon_id\" | grep -v grep | awk '{print \$2}') pid_found=\$(ps ax | awk '/$daemon -i $daemon_id / { if (\$5 != \"awk\" && \$5 != \"bash\") print \$1 }')
[ \"\$pid_found\" != \"\" ] || exit 1 # no pid, presumably not running [ -z \"\$pid_found\" ] && exit 1 # no pid, presumably not running
echo \$pid_found > $pidfile echo \$pid_found > $pidfile
fi fi
pid=\`cat $pidfile\` pid=\`cat $pidfile\`
cat /proc/\$pid/cmdline | tr '\\0' ' ' | grep $daemon | grep -qwe -i.$daemon_id && exit 0 # running cat /proc/\$pid/cmdline | tr '\\0' ' ' | grep -q '$daemon -i $daemon_id ' && exit 0 # running
exit 1 # pid is something else" "" "okfail" exit 1 # pid is something else" "" "okfail"
} }