Mark Burgess wrote:
Bas van der Vlies wrote:
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
------------------------------------------------------------------------
--- 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
Bug-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-cfengine
Bas - thanks for the patch. It looks susicously simplistic. HAve you
considered the case in which a PID can overap into a user name that
contains a number? Can you tell me exactly what the problem was that
this patch fixes? Without more info, I do not want to accept the
patch as I am suspicious of its simplicity.
M
I always i have learned that it must be simplistic ;-). It has todo that
it finds something the wrong pif if a username contains 8 chars and ends
with a char i think. Just in time i found an example, because the
cluster nodes are now cleaned ;-)
--- -d2 ----Applying filter kill_users
FilterProcMatch(UID,USER,root|postfix|daemon|ganglia|jaap|willem|bas|walter|bert|ramon|labraham,<bfdaed80>,<bfdaec60>)
Match
(root|postfix|daemon|ganglia|jaap|willem|bas|walter|bert|ramon|labraham)
to (v61u0055)
No match of
(root|postfix|daemon|ganglia|jaap|willem|bas|walter|bert|ramon|labraham)
to (v61u0055)
Prepending [PID]
Prepending [PPID]
Prepending [PGID]
Prepending [VSize]
Prepending [RSize]
Prepending [Status]
Prepending [Command]
Prepending [TTime]
Prepending [STime]
Prepending [TTY]
Prepending [Priority]
Prepending [Threads]
Matched proc[v61u0055 18258 18257 0 Jun03 ? 00:00:00
/usr/local/adf2004.01/bin/adf.exe ib-r6n7.irc.sara.nl 10833 -p4amslave
-p4yourname ib-r5n3 -p4rmrank 1]
Found matching pid 0
cfengine:ib-r5n3: will not signal or restart processes 0,1,2,3
cfengine:ib-r5n3: occurred while looking for .
That is for all process of this user. There are a loot on this node. The
patch fixes this problem. Is this enough info
in the cfrc we have a psopt: -ef
--
--
********************************************************************
* *
* 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 *
* *
********************************************************************
_______________________________________________
Bug-cfengine mailing list
Bug-cfengine@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-cfengine