[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: Anybody know who user-65534 is?



On Sat, Aug 16, 2014 at 7:59 PM, david <davcefai@keyworld.net> wrote:
> I.m starting to get the picture but we have moved away from what I think was
> the prime motive for this trhead to be started.
>
> User 65534 is causing a frustrating 90 - 120 second delay during shutdown.
> That's 6 to 9 hrs a year!
>
> Can this delay be eliminated? After all it did not used to happen before
> systemd was implemented.

Is there no message about a process that won't die gracefully, or
something similar, in the logs?

If not, the following may help:
------------------pfind.c----------------------
//* findps.c,
// a Q&D program to repeatedly look for something in the output of ps wwaux.
// Written by and copyright Joel Rees, Amagasaki, Japan, August 2014.
//
// Permission to use granted if the following three conditions are all met:
// Don't try to steal my copyrights.
// Don't blame me if it gets stuck or goes boom.
// Do use it for good purposes, by your definition of good.
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <unistd.h>

/*
# Compile it like this:

cc -Wall -o findps findps.c

# ----------
# Test it like this:

./findps nobody

# ----------
# Install it something like this:

chmod o-rwx findps
sudo cp -i findps /usr/local/bin/
sudo chown root:root /usr/local/bin/findps
sudo touch /var/log/foundps.log

# To catch the culprit running as nobody
# and holding up your shutdown processes,
# call it in your shutdown script something like this:

findps nobody 100 > /var/log/foundps.log &

# See also
man ps
# and look for where to find the numeric process id.
# If it gets out of control,
# getting another terminal session should help. Then
man kill
# Also, the return key and
# ctrl-s
# may be useful. But
# ctrl-z
# might not be so useful. But
man bg
# anyway. Or, I mean,
man sh
# and remember to search with the "/" command:
# /bg
# /job
# and so forth.

# An equivalent shell script, without parameter checks, etc. might
look like this:
# ------------
#! /bin/bash
lim=$2
for (( ct = 0; ct < lim; ++ct )) ; do ps wwaux | grep $1; sleep 1; done
# ------------
*/


#define BIGCOMMANDSZ 1024


int main( int argc, char * argv[] )
{
    char cmdbuff[ BIGCOMMANDSZ + 1];
    int limit = 10; /* Maximum times through the loop. */

    if ( argc < 2 )
    {    fprintf( stderr, "Usage: %s <search-term> [<limit-count>]\n",
argv[ 0 ] );
        fprintf( stderr, "\tDefault limit count is %d\n", limit );
        return EXIT_FAILURE;
    }
    if ( argc > 2 )
    {    limit = (int) strtol( argv[ 2 ], NULL, 10 );
    }
    cmdbuff[ BIGCOMMANDSZ ] = '\0';
    strncpy( cmdbuff, "ps wwaux | grep ", BIGCOMMANDSZ );
    strncat( cmdbuff, argv[ 1 ], BIGCOMMANDSZ );
    for ( ;limit > 0; --limit )
    {    system( cmdbuff );
        sleep( 1 );    /* So it doesn't run away too fast. */
    }
    return EXIT_SUCCESS;
}

--------------------------------------------------

I'm sure I could do that in a shell script if I took the time to
refresh my memory.

-- 
Joel Rees

Be careful where you see conspiracy.
Look first in your own heart.


Reply to: