tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Controlling Daemons (inetd or aunchd or relaunchd?)



Bruno Melo wrote in
 <g7EJelBCZlm3Y4JxNh1J9f2guqWnLrf9HljjW41O2j7QBQwl9bNtkSOAr3WNrbc1QwRGXSf\
 brlg2YyD6USd_p8nbTai_GXUR-nk2dl_UlZs=@protonmail.com>:
 |> I am Qingyao Sun, a student looking forward to participating in a GSoC
 |> project for NetBSD this year. One project I am interested in is "Port
 |> launchd" http://wiki.netbsd.org/projects/project/launchd-port/. I have
 |> reached out to Christos Zoulas, the prospective mentor of that project, \
 |> but
 |> he said that replacing init/rc with launchd could be a little
 |> controversial, and suggested me ask your opinions on the list.
 |> 
 |
 |I think non-controversials options are importing classic daemontools \
 |or importing runit like Void Linux does. Relaunchd is a good idea, \

I personally use something scripted that polls periodically
instead (for most).  It is pretty easy (most of the time), like

  sshd__init() {
     name=sshd
     pid=/run/${name}.pid
     prog=$(command -v ${name} 2>/dev/null)
  }

  sshd_start() {
     sshd__init
     if [ -f /root/hosts/${HOSTNAME}/sshd-ed25519 ]; then :; else
        ssh-keygen -q -t ed25519 -N '' -f /root/hosts/${HOSTNAME}/sshd-ed25519
     fi
     eval ${ssd} --start --pidfile ${pid} --exec ${prog} -- ${SSHD_ARGS}
  }

  sshd_stop() { sshd__init; ${ssd} --stop --retry 10 --pidfile ${pid}; }
  sshd_status() { sshd__init; daemons__stat_and_dog n; }
  sshd_watchdog() { sshd__init; daemons__stat_and_dog y; }

where ssd is start-stop-daemon (of busybox, or Debian, where the
former complicates thinfs a bit; and namespace / unshare boxes do,
too).

I personally think UNIX should be as easy as the above.
runit is very interesting, but i think being able to redirect
deaths of daemonized programs to another process like init(8) is
a real improvement that Linux has with PR_SET_CHILD_SUBREAPER and
PR_SET_PDEATHSIG of prctl(2), and the FreeBSD approach is even
more fine-grained.  But i personally again really admire
unshare(1) of Linux with CLONE_NEWPID.
I think what i mean is, isn't it better to have the possibilities
in the kernel to provide such, and then the freedom to use shell
scripts, than something like systemd?

 |but need to be more stable to replace classic init. Launchd itself \
 |is now closed source and full of Mach dependencies as far as I looked \
 |the code, you would need to implement Mach microkernel as a kernel \
 |module like NextBSD did and like previous NetBSD had. I still prefer \
 |the daemontools or runit options (runit runs not being the PID1 too). 
 --End of <g7EJelBCZlm3Y4JxNh1J9f2guqWnLrf9HljjW41O2j7QBQwl9bNtkSOAr3WNrb\
 c1QwRGXSfbrlg2YyD6USd_p8nbTai_GXUR-nk2dl_UlZs=@protonmail.com>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Home | Main Index | Thread Index | Old Index