deamon help

Barry Shein bzs at world.std.com
Wed Feb 6 02:56:00 AEST 1991


>I have just been given the assignment of writting a deamon that would monitor
>a list of programs for inactivity and after a certain amount of inactive time,
>send a signal to the process.  The process would then do a gracefull shutdown.
>
>One requirement is that this program must work under SysV and BSD (SunOS).  

Just write a shell script loop which uses awk to suck out the TIME
field of the procs as reported by ps and see if it's changing or not.
The only problem is that the command-line flags are gratuitously
different for ps on SYSV and BSD (tho Sun/OS must have the SYSV clone
version.) You could probably do some test to just change the flags
fields.

For a problem like this I'll bet you a nickel crafting the whole thing
in C using /dev/kmem etc will not be much faster than the above
described script, and will take a week to get right instead of 30
minutes.

(hmm, just checked, Sun/OS doesn't seem to have a SYSV clone ps,
probably for the same reason people don't serve cooking wine at their
dinner table.)
-- 
        -Barry Shein

Software Tool & Die    | bzs at world.std.com          | uunet!world!bzs
Purveyors to the Trade | Voice: 617-739-0202        | Login: 617-739-WRLD



More information about the Comp.lang.c mailing list