From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1048 Path: news.gmane.org!not-for-mail From: Alex Efros Newsgroups: gmane.comp.sysutils.supervision.general Subject: correct /etc/runit/{1,3} Date: Wed, 15 Feb 2006 15:33:52 +0200 Organization: asdfGroup Inc., http://powerman.asdfGroup.com/ Message-ID: <20060215133352.GG29956@home.power> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1140010444 1206 80.91.229.2 (15 Feb 2006 13:34:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 15 Feb 2006 13:34:04 +0000 (UTC) Original-X-From: supervision-return-1284-gcsg-supervision=m.gmane.org@list.skarnet.org Wed Feb 15 14:33:59 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1F9Mn3-0005u5-Bj for gcsg-supervision@gmane.org; Wed, 15 Feb 2006 14:33:53 +0100 Original-Received: (qmail 30147 invoked by uid 76); 15 Feb 2006 13:34:14 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 30141 invoked from network); 15 Feb 2006 13:34:14 -0000 Original-To: supervision@list.skarnet.org Mail-Followup-To: supervision@list.skarnet.org Content-Disposition: inline User-Agent: Mutt/1.5.11 Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1048 Archived-At: Hi! Here is all details needed to write correct /etc/runit/1 and /etc/runit/3 scripts, which boot/shutdown system without using standard scripts in /etc/init.d/. In /etc/runit/1: - touch/chmod /etc/runit/stopit to configure default action (shutdown or not) if Ctrl+Alt+Del pressed but /etc/runit/ctrlaltdel don't configure /etc/runit/stopit itself - touch/chmod /etc/runit/reboot to set default action (halt or reboot) if: 1) /etc/runit/1 crash or exit 100 2) /etc/runit/2 exit non 111 3) Ctrl+Alt+Del pressed, but /etc/runit/ctrlaltdel don't configure /etc/runit/reboot itself - if system support runlevels, then analyze /proc/cmdline and/or environment variables (set from kernel param) and run runsvchdir to set selected (or default) runlevel - exit 0 to continue booting to stage 2 (without this exit code from last executed command will be used, which is unpredictable) In /etc/runit/3: - to be able to run bash in case of emergency: exec /dev/console - to guarantee user will see messages printed from /etc/runit/3: chvt 1; stty sane ; echo - to guarantee all 'runsvdir' processes (not killed by runit when it send TERM to /etc/runit/2 if /etc/runit/2 wasn't exec'ed into runsvdir AND possibly running by non-root users for their own services) exited and will not resist to killing services; AND to signal all 'runsv' processes (including running by non-root users) to exit: killall5 -15 or: killall -TERM runsvdir killall -TERM runsv - to give all services 7 seconds for clean exit AND to guarantee all /var/services/*/log/ subservices will've a chance for clean exit before they'll killed by 'killall5 -9': sv force-stop /var/service/* (this will've side effect after 'killall -TERM runsv' as sending second TERM to all services shortly after first, I'm not sure is this can damage some services) - few seconds later, before unmounting everything: killall5 -9 Is this looks correctly? Any ideas about lost or redundant commands? -- WBR, Alex.