From owner-freebsd-questions@FreeBSD.ORG Tue Aug 17 01:24:07 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C33A9106566C for ; Tue, 17 Aug 2010 01:24:07 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 7F9108FC08 for ; Tue, 17 Aug 2010 01:24:06 +0000 (UTC) Received: from r55.edvax.de (port-92-195-116-86.dynamic.qsc.de [92.195.116.86]) by mx01.qsc.de (Postfix) with ESMTP id 2585D3D4A5; Tue, 17 Aug 2010 03:23:28 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id o7H1NROw010978; Tue, 17 Aug 2010 03:23:27 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Tue, 17 Aug 2010 03:23:27 +0200 From: Polytropon To: fbsd@dannysplace.net Message-Id: <20100817032327.0349772b.freebsd@edvax.de> In-Reply-To: <4C69D13F.9080404@dannysplace.net> References: <4C69D13F.9080404@dannysplace.net> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: Upgrading ports while processes are running. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2010 01:24:07 -0000 On Tue, 17 Aug 2010 10:01:03 +1000, Danny Carroll 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, ...