Hello,

 we are using cfengine 2.1.20.

We kill all the processes of user when the job has finished on our cluster. For some reasons not all processes are killed for some usernames.

example script:
#!/usr/sbin/cfagent -K -x -f
#
# This is the cfengine clean up script for cleaning up login
#

control:

  actionsequence = ( processes )

processes:
  ".*"
        signal=kill
        action=do
        filter=kill_users

filters:

{ kill_users
  Owner: "root|postfix|daemon|ganglia|jaap|willem|bas|walter|bert|ramon"
  Result: "!Owner"
}


I have patches process.c. The diff is included as patch.

Regards

--
--
********************************************************************
*                                                                  *
*  Bas van der Vlies                     e-mail: [EMAIL PROTECTED]      *
*  SARA - Academic Computing Services    phone:  +31 20 592 8012   *
*  Kruislaan 415                         fax:    +31 20 6683167    *
*  1098 SJ Amsterdam                                               *
*                                                                  *
********************************************************************
--- process.c.org	2005-02-08 12:50:02.000000000 +0100
+++ process.c	2006-07-11 12:29:30.243631590 +0200
@@ -330,46 +330,34 @@
       
       Debug("Matched proc[%s]\n",ip->name);
 
-      one_space = false;
-      
       for (sp = ip->name; *sp != '\0'; sp++) /* if first field contains alpha, skip */
          {
          while (true)
             {
-            while (!isdigit((int)*sp) && (*sp != '\0'))
-               {
-               if (*sp == ' ')
-                  {
-                  one_space = true;
-                  }
-               sp++;
-               }
-
-            if (!one_space)
-               {
-               while(*sp != ' ' && *sp != '\t')
+            /* HvB If start with alpha then skip it till the first space */
+	    if (isalnum((int)*sp))
+	       {
+	       while ((*sp != ' ') && (*sp != '\0'))
                   {
                   sp++;
-                  }
-               }
-            
-            if ((sp > ip->name) && isalnum((int)*(sp-1))) /* Username contains number*/
-               {
-               sp++;
-               }
-            else
-               {
-               break;
-               }
-            }
+		  }
+	       }
+
+	       /* skip spaces and tabs */
+               while ((*sp == ' ') && (*sp == '\t'))
+	          {
+		  sp++;
+		  }
+             break;
+             } /* end while */
   
          sscanf(sp,"%d",&pid);
-         
+	
          if (pid != -1)
             {
             break;
             }
-         }  
+         } /* end for */
       
       if (pid == -1)
          {
_______________________________________________
Bug-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-cfengine

Reply via email to