supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Alex Efros <powerman@powerman.asdfGroup.com>
Subject: correct /etc/runit/{1,3}
Date: Wed, 15 Feb 2006 15:33:52 +0200	[thread overview]
Message-ID: <20060215133352.GG29956@home.power> (raw)

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 &>/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.


                 reply	other threads:[~2006-02-15 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060215133352.GG29956@home.power \
    --to=powerman@powerman.asdfgroup.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).