Date: Tue, 17 Aug 2010 03:23:27 +0200 From: Polytropon <freebsd@edvax.de> To: fbsd@dannysplace.net Cc: freebsd-questions@freebsd.org Subject: Re: Upgrading ports while processes are running. Message-ID: <20100817032327.0349772b.freebsd@edvax.de> In-Reply-To: <4C69D13F.9080404@dannysplace.net> References: <4C69D13F.9080404@dannysplace.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 17 Aug 2010 10:01:03 +1000, Danny Carroll <fbsd@dannysplace.net> wrote: > Will a port install fail if it cannot write to a file because it's in-use? At least, the step that wants to write will fail, and this will mostly be (finally) signaled by a make error. UNIX doesn't have a "file in use" paradigm per se; i. e. you can open one and the same file in two editors simultaneously, and depending on which editor performs SAVE FILE, the file's content on disk will vary. Of course, there's file locking (see "man flock"). > Also, is it necessary to restart the server or at lease the apps after a > port upgrade? This depends on the programs. In most cases, it's useful to stop a kind of "server app" before performing the update, and then restarting it after the upgrade has been performed. Restarting the server isn't neccessary in most cases. You usually won't have much trouble with programs that are "started many times" (like editor, media player), as they will surely survive an update, and don't affect the system if they won't. > The answer to the second question is certainly yes. But is it > considered dangerous to upgrade a port that is currently running? > Things like mysql and apache come to mind. I always went with the method "stop, upgrade, start" - it's not that short downtimes (planned!) have gotten me into trouble. :-) > To take it one step further, what about shared libraries? If a process > is using a shared lib, then it seems that it does not lock the file for > writing, but I would think that it would not start using the lib until > you restarted all of the processes that used that shared lib. > Once the last process using the shared lib is killed, is it > automatically unlinked from memory? I think so, allthough I think there's a caching mechanism for shared libraries (ld cache). > I guess best practice should be to restart the system after a major port > upgrade (unless you know which processes depend on the files that have > been upgraded - then you should just be able to restart those processes). Most server apps provide rc.d style scripts which makes it quite easy to "cleanly" stop them before the update, so you don't have to manually hunt processes. This mechanism enables you to selectively prevent programs from being interfered by their respective updating procedures. A system reboot is highly encouraged when updating the OS or kernel components. If you are unsure and don't care for uptime, you *can* reboot, as it won't make things worse. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100817032327.0349772b.freebsd>