summaryrefslogtreecommitdiff
path: root/cad/linuxcnc-devel/files/patch-scripts_realtime.in
blob: ba3b23815bbf7dc250487a367b447a6c7f49da21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- scripts/realtime.in.orig	2016-06-25 02:19:12 UTC
+++ scripts/realtime.in
@@ -6,7 +6,7 @@
 
 export LANG=C
 
-PIDOF=@PIDOF@
+HALCMD="halcmd"
 
 CheckKernel() {
     case "@KERNEL_VERS@" in
@@ -104,7 +104,7 @@ CheckConfig(){
 CheckStatus(){
     case $RTPREFIX in
     uspace)
-        if [ -z "$($PIDOF rtapi_app)" ]; then
+        if [ `$HALCMD -s show comp | wc -l` -eq 2 ]; then
             exit 1
         else
             exit 0
@@ -187,15 +187,14 @@ Unload(){
         # wait 5 seconds for rtapi_app to die and be reaped by its parent
         START=$SECONDS
         while [ 5 -gt $((SECONDS-START)) ]; do
-            if ! ps -C rtapi_app > /dev/null 2> /dev/null; then
+            if [ `$HALCMD -s show comp | wc -l` -eq 2 ]; then
                 break
             fi
             sleep 0.1
         done
-        if ps -C rtapi_app > /dev/null 2> /dev/null; then
+        if [ `$HALCMD -s show comp | wc -l` -ne 2 ]; then
             echo "ERROR: rtapi_app failed to die" 1>&2
         fi
-
         ipcrm -M 0x48414c32 2>/dev/null ;# HAL_KEY
         ipcrm -M 0x90280A48 2>/dev/null ;# RTAPI_KEY
         ipcrm -M 0x48484c34 2>/dev/null ;# UUID_KEY