supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* correct /etc/runit/{1,3}
@ 2006-02-15 13:33 Alex Efros
  0 siblings, 0 replies; only message in thread
From: Alex Efros @ 2006-02-15 13:33 UTC (permalink / 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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-15 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-15 13:33 correct /etc/runit/{1,3} Alex Efros

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).