Re: {bb} BB shutdown kill problems - solved
Philip Clark <[email protected]> Thu, 13 Sep 2007 01:59:55 +0100
| Newsgroups | gmane.network.bb4.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2007-09-11 at 23:10 +0100, John Horne wrote: > Hello, > > Apologies if this has been discussed and resolved before, but, as > mentioned earlier, the list archives seem to have stopped. As far as I > can tell others have had at least one of these problems, but the last > one mentioned is from the end of 2005. > > I have finally gotten around to looking at a couple of problems that we > have had for some time when stopping BB. Using BB version 1.9i, when we > stop BB (on Fedora, RHEL and CentOS systems) using a script we get: > > # service bb stop > Stopping Big Brother/home/bbuser/bbc/runbb.sh: line 145: kill: (29925) > - Operation not permitted > > If we run the runbb.sh script manually, as the BB user, we get a > 'Terminated' error message, and the BBPID and runbb.sh files left dumped > in the BB tmp directory. If you stop and start BB a few times, you get a > collection of these files! > > Solutions: > 1) The 'Terminated' error and the files being left behind is because the > runbb.sh script is killing itself off before it finishes. Hence the > 'Terminated' message. Changing runbb.sh at line 137 onwards > from: > > if test "$PSTYPE" > then > # try clean > kill $2 > # then not so clean > kill -9 $2 >/dev/null 2>&1 > else > # try clean > kill $1 > # then not so clean > kill -9 $1 >/dev/null 2>&1 > fi > > to: > > if test "$PSTYPE" > then > test $2 = $$ && continue > # try clean > kill $2 > # then not so clean > kill -9 $2 >/dev/null 2>&1 > else > test $1 = $$ && continue > # try clean > kill $1 > # then not so clean > kill -9 $1 >/dev/null 2>&1 > fi > > The 2 additional lines simply say that if the PID being looked at is the > PID of this process, then ignore it. This way the runbb.sh script > finishes, and the BBPID and runbb.sh files are removed. Nice :) > 2) The 'Operation not permitted' error problem may not affect all users. > In our case, following the README.INSTALL instructions (section 5), we > created a soft link in the BB users home directory to the actual > installation directory. Hence, in our case, /home/bbuser/bbc is a link > to /home/bbuser/bbc1.9i-btf. In the startup/shutdown script, *and* in > the runbb.sh script we changed BBHOME to '/home/bbuser/bbc'. > > The 'Operation not permitted' error is caused by the runbb.sh script > looking for all the processes with the string $BBHOME in them, and > trying to kill them off. However, when using our script to start and > stop BB, this is run as root, BB sees the root process in the 'ps' > command output that it uses. It then tries to kill the process off. > Obviously the BB user is not allowed to kill off a root process, so you > get the 'Operation not permitted' error. > > If you created the soft link, and used that in your startup/shutdown > script and left the runbb.sh script alone (so in our case it would have > 'BBHOME=/home/bbuser/bbc1.9i-btf'), then the problem does not occur. The > reason is that runbb.sh looks through the 'ps' output for processes > using '/home/bbuser/bbc1.9i-btf', but the shutdown script is using > '/home/bbuser/bbc'. Hence runbb.sh does not see the root process, so > does not try and kill it off, and so we get no 'Operation not permitted' > error message. > > So to some extent this problem was caused by ourselves. We have put back > the runbb.sh script to its original self, and stopping BB now works > fine. I think that was the original intention of the symlink, to avoid the need to update any "rc" scripts when BB was updated. It might be helpful, however, to add a note in the documentation to ensure that people don't use the symlinked path when setting BBHOME. Cheers, Phil. -- Abstainer, n.: A weak person who yields to the temptation of denying himself a pleasure. (Ambrose Bierce, "The Devil's Dictionary") -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-= To unsubscribe from this list, or to subscribe to the bb-digest list send e-mail to mailto:[email protected] with unsubscribe bb -and/or- subscribe bb-digest in the BODY of the message.