initial commit of file from CVS for e-smith-runit on Wed 12 Jul 09:08:56 BST 2023

This commit is contained in:
Brian Read
2023-07-12 09:08:56 +01:00
parent b831a10d1c
commit e7ef021b3b
15 changed files with 852 additions and 2 deletions

0
root/etc/e-smith/events/.gitignore vendored Normal file
View File

14
root/etc/init/runit.conf Normal file
View File

@@ -0,0 +1,14 @@
# runit - start runit supervisors
#
# This task runs the runit start script, which runs runsvdir
start on runlevel [345]
stop on runlevel [!$RUNLEVEL]
task
export RUNLEVEL
console output
exec /etc/runit/2 $RUNLEVEL

138
root/etc/rc.d/init.d/daemontools Executable file
View File

@@ -0,0 +1,138 @@
#!/bin/sh
###########################################################################
#
# System V style init script.
# Relies on runit utilities to do the real work.
# It is assumed that init scripts will be linked to this script.
#
###########################################################################
# Determine the service name and its service directory from $0
prog=$(/bin/basename $0 | sed -e 's/^[SK][0-9][0-9]*//')
SERVICE_DIR=/service/$prog
###########################################################################
# Source in the RedHat initscripts functions
SYSTEMCTL_SKIP_REDIRECT=1
. /etc/rc.d/init.d/functions
# The maximum amount of time to wait for a process to shut down, in seconds.
SVWAIT=60
start()
{
/bin/echo -n $"Starting $prog:"
dirs=$1
if [ -d $1/log ]; then
dirs="$1/log $1"
fi
/usr/bin/sv u $dirs > /dev/null
if [ $? -ne 0 ]; then
failure "Starting $prog"
else
success "Starting $prog"
fi
/bin/echo
}
stop()
{
/bin/echo -n $"Stopping $prog:"
/usr/bin/sv stop $1 > /dev/null
if [ $? -ne 0 ]; then
failure "Stopping $prog"
else
success "Stopping $prog"
fi
/bin/echo
}
# This function not only shuts the service down, but removes the /service
# symlink and shuts down the logger. This should only be used during an
# uninstall of the service in question.
svdisable()
{
/bin/echo -n $"Disabling $prog:"
stop $1
cd $1 && rm -f $1
dirs=.
if [ -e log ]; then
dirs="$dirs ./log"
fi
/usr/bin/sv d $dirs
/usr/bin/sv x $dirs
if [ $? -ne 0 ]; then
failure "Disabling $prog"
else
success "Disabling $prog"
fi
/bin/echo
}
case $1 in
restart)
action "Restarting $prog" /usr/bin/sv t $SERVICE_DIR
/usr/bin/sv u $SERVICE_DIR
;;
sigalrm)
action "Sending ALRM signal to $prog" /usr/bin/sv a $SERVICE_DIR
;;
sigcont)
action "Sending CONT signal to $prog" /usr/bin/sv c $SERVICE_DIR
;;
sighup)
action "Sending HUP signal to $prog" /usr/bin/sv h $SERVICE_DIR
;;
sigusr1)
action "Sending USR1 signal to $prog" /usr/bin/sv 1 $SERVICE_DIR
;;
sigusr2)
action "Sending USR2 signal to $prog" /usr/bin/sv 2 $SERVICE_DIR
;;
sigint)
action "Sending INT signal to $prog" /usr/bin/sv i $SERVICE_DIR
;;
sigkill)
action "Sending KILL signal to $prog" /usr/bin/sv k $SERVICE_DIR
;;
sigstop)
action "Sending STOP signal to $prog" /usr/bin/sv p $SERVICE_DIR
;;
sigterm|condrestart)
action "Sending TERM signal to $prog" /usr/bin/sv t $SERVICE_DIR
;;
status)
/usr/bin/sv status $SERVICE_DIR
;;
start)
start $SERVICE_DIR
;;
stop)
stop $SERVICE_DIR
;;
svdisable)
svdisable $SERVICE_DIR
;;
*)
echo $"usage: $0 {start|stop|restart|status|sigalrm|sigcont|sighup|sigint|sigkill|sigstop|sigterm|condrestart|sigusr1|sigusr2|svdisable}"
;;
esac

6
root/etc/runit/2 Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
exec </dev/null
exec runsvdir -P /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................'

3
root/usr/bin/svc-start Executable file
View File

@@ -0,0 +1,3 @@
#! /bin/sh
exec /etc/rc.d/init.d/$1 start

3
root/usr/bin/svc-stop Executable file
View File

@@ -0,0 +1,3 @@
#! /bin/sh
exec /etc/rc.d/init.d/$1 stop

View File

@@ -0,0 +1,15 @@
[Unit]
Description=Process Supervising Daemon
Before= bootstrap-console.service
Before=multi-user.target sme-server.target network.target network-pre.target
[Service]
Type=simple
User=root
Group=root
Restart=always
ExecStart=/etc/runit/2
TimeoutSec=0
[Install]
WantedBy=basic.target