rc.d/vkernel: pidfile related enhancements
authorRumko <rumcic@gmail.com>
Sun, 10 Oct 2010 18:21:35 +0000 (20:21 +0200)
committerAntonio Huete Jimenez <tuxillo@quantumachine.net>
Tue, 12 Oct 2010 21:13:56 +0000 (23:13 +0200)
Fix a typo when checking for the pid file when starting a vkernel.
Better checking if the vkernel being started is already running.

etc/rc.d/vkernel

index 3193482..3b0a928 100644 (file)
@@ -18,10 +18,13 @@ vkernel_start()
        do
                # Check if already running
                eval pidfile="/var/run/vkernel.${_vkernel}.pid"
-               if [ -f "${_pidfile}" ]; then
-                       echo
-                       warn "Vkernel ${_vkernel} already running? (check ${pidfile})"
-                       continue
+               if [ -f "${pidfile}" ]; then
+                       eval pid=`cat ${pidfile}`
+                       if [ ! -z "${pid}" -a ! -z "`ps axwwp ${pid} | grep -wE "^[ ]+${pid}" | grep -v grep | awk '{print $1}'`" ]; then
+                               echo
+                               warn "Vkernel ${_vkernel} already running? (check ${pidfile})"
+                               continue
+                       fi
                fi
 
                # Configure vkernel binary