From owner-freebsd-questions Wed Dec 12 9:56:32 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-31-201-166.mmcable.com [65.31.201.166]) by hub.freebsd.org (Postfix) with SMTP id 77C2437B417 for ; Wed, 12 Dec 2001 09:56:26 -0800 (PST) Received: (qmail 37816 invoked by uid 100); 12 Dec 2001 17:56:25 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15383.39497.553042.67029@guru.mired.org> Date: Wed, 12 Dec 2001 11:56:25 -0600 To: Filipe Brandenburger Cc: questions@freebsd.org Subject: Re: Doing "batch" updates in single-user mode In-Reply-To: <70168449@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ X-Delivery-Agent: TMDA v0.42/Python 2.1.1 (freebsd4) From: "Mike Meyer" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Filipe Brandenburger types: > I would like to know if there's somehow a way to do this without the need > to be on the console of the host. For example, I would like to know if > there's a way to write a script and tell FreeBSD to go into single-user > mode, execute the script, and get back to multi-user mode, without the need > to be on the console. You can't have a script that goes into single user mode and then does things. Going to single user mode stops all processes except init, which then gives you a shell on the console. > I have two reasons for that. One is that I have to manage many (30+) hosts > with FreeBSD, and I would like to update all (or most) of them at the same > time. Other reason is that I would like to be able to schedule this kind of > update to 3:00AM or something like that, so that fewer people will be > affected by the downtime of the host, and I would like to do this update > without the need to be at the business to have to type the commands. Ok, I > know this would probably be too dangerous to do without watching, but hey, > if I test it before on a testing machine, I don't see much trouble in doing > this... Ok, the safest sequence is: make buildworld make buildkernel make installkernel reboot to single user mode make installworld mergemaster reboot The first two steps are safe in multiuser mode, and will cause no problems. Installing a kernel may cause problems, but generally won't. If you're really brave, you can install the world and run mergemaster and usually be safe. The key word is *usually*. Then reboot, and if it comes back up, you're good. If not, you have to go to the console. If you've tested everything beforehand - always a good practice on a production machine - then you're right, you should be safe. But be prepared to go in anyway :-). At one point I hacked init to look for and run /etc/rc.single if it existed. You could do the same, and then have /etc/rc.single do the installworld and bring up enough network for you to log in from a second machine to run mergemaster and reboot it yourself. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message