Xref: utzoo comp.lang.c:35804 comp.unix.internals:1959 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!world!bzs From: bzs@world.std.com (Barry Shein) Newsgroups: comp.lang.c,comp.unix.internals,comp.unix.programmers Subject: Re: deamon help Message-ID: Date: 5 Feb 91 15:56:00 GMT References: <594@edpmgt.UUCP> Sender: bzs@world.std.com (Barry Shein) Organization: The World Lines: 27 In-Reply-To: gpitcher@edpmgt.UUCP's message of 4 Feb 91 23:01:04 GMT >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@world.std.com | uunet!world!bzs Purveyors to the Trade | Voice: 617-739-0202 | Login: 617-739-WRLD