:: Re: [DNG] init systems
Góra strony
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Dla: dng
Temat: Re: [DNG] init systems
The Original Linux Fan via Dng said on Tue, 7 Mar 2023 12:40:20 -0800

>SteveT,
>Could you post some example scripts on such a
>configuration?  Just a skeleton.  I don't know a thing
>about runit or s6 yet.


Here it is:

UNBOUND:
#!/bin/sh
exec unbound -dp

CUPSD:
#!/bin/sh
exec 2>&1
exec cupsd -f

CROND:
#!/bin/sh
[ -r conf ] && . ./conf
exec cronie-crond -n $OPTS 2>&1

AGETTY-TTY1:
#!/bin/sh

tty=${PWD##*-}

[ -r conf ] && . ./conf

if [ -x /sbin/getty -o -x /bin/getty ]; then
    # busybox
    GETTY=getty
elif [ -x /sbin/agetty -o -x /bin/agetty ]; then
    # util-linux
    GETTY=agetty
fi


exec chpst -P ${GETTY} ${GETTY_ARGS} \
    "${tty}" "${BAUD_RATE}" "${TERM_NAME}"



WPA_SUPPLICANT:
#!/bin/sh
if [ -r ./conf ]; then
    . ./conf
    : ${OPTS:=-M -c
${CONF_FILE:-/etc/wpa_supplicant/wpa_supplicant.conf}
${WPA_INTERFACE:+-i ${WPA_INTERFACE}} ${DRIVER:+-D ${DRIVER}} -s} else
. ./auto OPTS="${AUTO} -s"
fi


exec 2>&1
exec wpa_supplicant ${OPTS}


DOVECOT:
#!/bin/sh
exec 2>&1
install -d -m 0755 -o root -g root /var/run/dovecot
exec dovecot -F

DHCPCD:
#!/bin/sh
[ -r conf ] && . ./conf
exec dhcpcd -B ${OPTS:=-M} 1>&2

SSHD:
#!/bin/sh
ssh-keygen -A >/dev/null 2>&1 # Will generate host keys if they don't
                              # already exist
[ -r conf ] && . ./conf
exec /usr/bin/sshd -D $OPTS


DBUS:
#!/bin/sh
[ ! -d /run/dbus ] && install -m755 -g 22 -o 22 -d /run/dbus
exec dbus-daemon --system --nofork --nopidfile

HTH,

SteveT

Steve Litt
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm