Date: Wed, 17 May 2000 10:18:27 -0700 From: Doug Barton <DougB@gorean.org> To: Ben Smithurst <ben@scientia.demon.co.uk> Cc: Marc Silver <marcs@draenor.org>, freebsd-questions@freebsd.org Subject: Re: "Hangup" in mail from cron Message-ID: <3922D463.C2B7E366@gorean.org> References: <Pine.BSF.4.21.0005161231480.53178-100000@dt051n0b.san.rr.com> <20000517074925.F58332@draenor.org> <39223554.E45081A@gorean.org> <20000517141912.I10128@strontium.scientia.demon.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Ben Smithurst wrote: > > Doug Barton wrote: > > > if [ -n "${PID}" ]; then > > kill -HUP $PID > > else > > How is $PID obtained? PID=`ps -auxww | grep httpd | grep root | grep -v grep | awk '{ print $2 }'` > It looks to me like the HUP is being sent to the > shell script somehow, that would explain why the shell prints "Hangup" > and cron mails that to you. But I can't see how that would happen > unless the code to get $PID is badly broken. I see what you're saying, and it does sound like a valid option. I'm concerned about this though, because that's the whole point of the -n test. > On further investigation it seems that the shell prints Hangup when one of > its children sets SIGHUP, not when it itself gets SIGHUP. Anyway, knowing > how PID is determined might be useful. > > > ps -auxww | grep httpd | grep -v grep > > ps -auxww | grep '[h]ttpd' > > ok, so I'm very fussy about using too many processes when one fewer > would do. :-) I certainly agree that reducing subshells is a worthy goal. However that trick works with our (GNU) grep (although I've never seen a satisfactory explanation of why) but it doesn't work with Sun's, and I need my scripts to be portable. Thanks, Doug -- "Live free or die" - State motto of my ancestral homeland, New Hampshire Do YOU Yahoo!? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3922D463.C2B7E366>