Prechádzať zdrojové kódy

swupdate: Wait for process to exit

Modifies the sysVinit script to wait for the process to exit before
continuing. This prevents a quick stop and start or restart from
failing because the process wasn't finished exiting before the start was
called.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Joshua Watt 3 rokov pred
rodič
commit
d7af5bd8d3

+ 8 - 0
recipes-support/swupdate/swupdate/swupdate

@@ -76,6 +76,14 @@ do_stop() {
 		# Exit when fail to stop, the kill would complain when fail
 		kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \
 			echo "Stopped $DESC ($pid)." || exit $?
+
+                # Wait up to 10 seconds for the process to exit
+                for i in `seq 10`; do
+                        if ! pidofproc $NAME > /dev/null; then
+                                break
+                        fi
+                        sleep 1
+                done
 		;;
 	*)
 		echo "$DESC is not running; none killed." >&2