summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2011-07-06 18:55:37 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2011-07-06 18:55:37 +0000
commit051efd2013144227b104e47c08bdc09c2e1508d8 (patch)
treebf1ba0f515d3bcea1c9fe050ab655a625d3e12d7
parenta7a68c90254263498131236819cdb7e7740c05a1 (diff)
Add rc.d(8) script for the system daemons that are restartable.
From now on rc(8) is going to call these scripts to start them up on boot in the same order than before. In addition the inetd and rwhod variables in rc.conf are deprecated so that inetd_flags and rwhod_flags should be used. The old flags are still going to be used for some time to allow users to switch. There are more rc modifications to come later so let's put this in so we can base more work on this. It is important to mention that you can still keep using rc.local just like the way you did before, and we have no intention to remove that either. I'd also like to thank ajacoutot@, halex@, sthen@ and schwarze@ for working on this with me.
-rw-r--r--etc/Makefile11
-rw-r--r--etc/rc233
-rw-r--r--etc/rc.conf12
-rw-r--r--etc/rc.d/apmd11
-rw-r--r--etc/rc.d/bgpd11
-rw-r--r--etc/rc.d/bootparamd15
-rw-r--r--etc/rc.d/cron9
-rw-r--r--etc/rc.d/dhcpd15
-rw-r--r--etc/rc.d/dhcrelay11
-rw-r--r--etc/rc.d/dvmrpd11
-rw-r--r--etc/rc.d/ftpd11
-rw-r--r--etc/rc.d/ftpproxy11
-rw-r--r--etc/rc.d/hostapd9
-rw-r--r--etc/rc.d/hotplugd9
-rw-r--r--etc/rc.d/httpd15
-rw-r--r--etc/rc.d/identd11
-rw-r--r--etc/rc.d/ifstated9
-rw-r--r--etc/rc.d/iked17
-rw-r--r--etc/rc.d/inetd9
-rw-r--r--etc/rc.d/isakmpd17
-rw-r--r--etc/rc.d/ldapd9
-rw-r--r--etc/rc.d/ldattach15
-rw-r--r--etc/rc.d/ldpd11
-rw-r--r--etc/rc.d/lpd9
-rw-r--r--etc/rc.d/mopd15
-rw-r--r--etc/rc.d/mrouted9
-rw-r--r--etc/rc.d/named11
-rw-r--r--etc/rc.d/nsd9
-rw-r--r--etc/rc.d/ntpd11
-rw-r--r--etc/rc.d/rarpd15
-rw-r--r--etc/rc.d/rbootd9
-rw-r--r--etc/rc.d/rc.subr4
-rw-r--r--etc/rc.d/relayd11
-rw-r--r--etc/rc.d/ripd11
-rw-r--r--etc/rc.d/route6d9
-rw-r--r--etc/rc.d/rtadvd11
-rw-r--r--etc/rc.d/rtsold11
-rw-r--r--etc/rc.d/rwhod9
-rw-r--r--etc/rc.d/sasyncd11
-rw-r--r--etc/rc.d/sendmail11
-rw-r--r--etc/rc.d/sensorsd9
-rw-r--r--etc/rc.d/smtpd9
-rw-r--r--etc/rc.d/snmpd11
-rw-r--r--etc/rc.d/sshd9
-rw-r--r--etc/rc.d/syslogd24
-rw-r--r--etc/rc.d/timed11
-rw-r--r--etc/rc.d/watchdogd9
47 files changed, 543 insertions, 207 deletions
diff --git a/etc/Makefile b/etc/Makefile
index e4d5e738daf..17fd40c958f 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.296 2011/07/06 18:32:58 miod Exp $
+# $OpenBSD: Makefile,v 1.297 2011/07/06 18:55:36 robert Exp $
TZDIR= /usr/share/zoneinfo
LOCALTIME= Canada/Mountain
@@ -30,6 +30,13 @@ BIN1+= wsconsctl.conf
# -rw-rw-r--
BIN2= motd
+# -r-xr-xr-x
+RCDAEMONS= apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd ftpd ftpproxy \
+ hostapd hotplugd httpd identd ifstated iked inetd isakmpd ldapd \
+ ldattach ldpd lpd mopd mrouted named nsd ntpd rarpd rbootd relayd \
+ ripd route6d rtadvd rtsold rwhod sasyncd sendmail sensorsd smtpd \
+ snmpd sshd syslogd timed watchdogd
+
MISETS= base${OSrev}.tgz comp${OSrev}.tgz \
man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
@@ -249,6 +256,8 @@ distribution-etc-root-var: distrib-dirs
${DESTDIR}/etc/sudoers
cd rc.d; \
${INSTALL} -c -o root -g wheel -m 644 rc.subr \
+ ${DESTDIR}/etc/rc.d && \
+ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
${DESTDIR}/etc/rc.d
distribution:
diff --git a/etc/rc b/etc/rc
index 1f7209f5f5a..569d53f1c14 100644
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-# $OpenBSD: rc,v 1.352 2011/04/22 06:08:14 ajacoutot Exp $
+# $OpenBSD: rc,v 1.353 2011/07/06 18:55:36 robert Exp $
# System startup script run by init on autoboot
# or after single-user.
@@ -142,6 +142,17 @@ fill_baddynamic()
}
}
+start_daemon()
+{
+ local _n;
+ for _n; do
+ eval _do=\${${_n}_flags}
+ if [ X"${_do}" != X"NO" ]; then
+ /etc/rc.d/${_n} start
+ fi
+ done
+}
+
# End subroutines
stty status '^T'
@@ -340,26 +351,9 @@ rm -f /var/spool/uucp/STST/*
# save a copy of the boot messages
dmesg >/var/run/dmesg.boot
-echo 'starting system logger'
-rm -f /dev/log
-if [ X"${httpd_flags}" != X"-u" ]; then
- rm -f /var/www/dev/log
- syslogd_flags="${syslogd_flags} -a /var/www/dev/log"
-fi
-if [ X"${named_flags}" != X"NO" ]; then
- rm -f /var/named/dev/log
- syslogd_flags="${syslogd_flags} -a /var/named/dev/log"
-fi
-if [ X"${nsd_flags}" != X"NO" ]; then
- rm -f /var/nsd/dev/log
- syslogd_flags="${syslogd_flags} -a /var/nsd/dev/log"
-fi
-if [ -d /var/empty ]; then
- rm -f /var/empty/dev/log
- mkdir -p -m 0555 /var/empty/dev
- syslogd_flags="${syslogd_flags} -a /var/empty/dev/log"
-fi
-syslogd ${syslogd_flags}
+echo -n 'starting system logger: '
+start_daemon syslogd
+echo '.'
if [ X"${pf}" != X"NO" ]; then
ifconfig pflog0 create >/dev/null 2>&1
@@ -381,13 +375,11 @@ if [ X"${named_flags}" != X"NO" ]; then
echo failed.
fi
fi
-
- echo 'starting named'; named $named_flags
fi
-if [ X"${nsd_flags}" != X"NO" ]; then
- echo 'starting nsd'; nsd $nsd_flags
-fi
+echo -n 'starting name service daemons:'
+start_daemon named nsd
+echo '.'
if [ ! -f /etc/isakmpd/private/local.key ]; then
echo -n "openssl: generating new isakmpd/iked RSA key... "
@@ -409,23 +401,9 @@ if [ ! -f /etc/iked/private/local.key ]; then
cp /etc/isakmpd/local.pub /etc/iked/local.pub
fi
-if [ X"${isakmpd_flags}" != X"NO" ]; then
- if [ X"${sasyncd_flags}" != X"NO" ]; then
- isakmpd_flags="-S ${isakmpd_flags}"
- fi
- echo 'starting isakmpd'; isakmpd ${isakmpd_flags}
-fi
-
-if [ X"${iked_flags}" != X"NO" ]; then
- if [ X"${sasyncd_flags}" != X"NO" ]; then
- iked_flags="-S ${iked_flags}"
- fi
- echo 'starting iked'; iked ${iked_flags}
-fi
-
-if [ X"${sasyncd_flags}" != X"NO" ]; then
- echo 'starting sasyncd'; sasyncd ${sasyncd_flags}
-fi
+echo -n 'starting IPsec daemons:'
+start_daemon isakmpd iked sasyncd
+echo '.'
if [ X"${ipsec}" != X"NO" ]; then
if [ -f ${ipsec_rules} ]; then
@@ -493,17 +471,8 @@ if [ X"${rdate_flags}" != X"NO" ]; then
echo -n ' rdate'; rdate -s ${rdate_flags}
fi
-if [ X"${timed_flags}" != X"NO" ]; then
- echo -n ' timed'; timed $timed_flags
-fi
-
-if [ X"${ldattach_flags}" != X"NO" -a -n "${ldattach_flags}" ]; then
- echo -n ' ldattach'; ldattach ${ldattach_flags}
-fi
+start_daemon timed ldattach ntpd
-if [ X"${ntpd_flags}" != X"NO" ]; then
- echo -n ' ntpd'; ntpd $ntpd_flags
-fi
echo '.'
mount -a
@@ -619,83 +588,23 @@ fi
/usr/bin/ssh-keygen -A
-echo -n starting network daemons:
-
-if [ X"${sshd_flags}" != X"NO" ]; then
- echo -n ' sshd'; /usr/sbin/sshd ${sshd_flags}
-fi
-
-if [ X"${snmpd_flags}" != X"NO" ]; then
- echo -n ' snmpd'; /usr/sbin/snmpd $snmpd_flags
-fi
-
-if [ X"${ldpd_flags}" != X"NO" ]; then
- echo -n ' ldpd'; /usr/sbin/ldpd $ldpd_flags
-fi
-
-if [ X"${ripd_flags}" != X"NO" ]; then
- echo -n ' ripd'; /usr/sbin/ripd $ripd_flags
-fi
-
-if [ X"${mrouted_flags}" != X"NO" ]; then
- echo -n ' mrouted'; mrouted $mrouted_flags
-fi
-
-if [ X"${dvmrpd_flags}" != X"NO" ]; then
- echo -n ' dvmrpd'; /usr/sbin/dvmrpd $dvmrpd_flags
-fi
-
-if [ X"${ospfd_flags}" != X"NO" ]; then
- echo -n ' ospfd'; /usr/sbin/ospfd $ospfd_flags
-fi
-
-if [ X"${ospf6d_flags}" != X"NO" ]; then
- echo -n ' ospf6d'; /usr/sbin/ospf6d $ospf6d_flags
-fi
-
-if [ X"${bgpd_flags}" != X"NO" ]; then
- echo -n ' bgpd'; /usr/sbin/bgpd $bgpd_flags
-fi
-
-if [ X"${ifstated_flags}" != X"NO" ]; then
- echo -n ' ifstated'; ifstated $ifstated_flags
-fi
-
-if [ X"${relayd_flags}" != X"NO" ]; then
- echo -n ' relayd'; /usr/sbin/relayd $relayd_flags
-fi
-
-if [ X"${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
- touch /var/db/dhcpd.leases
- echo -n ' dhcpd'; /usr/sbin/dhcpd ${dhcpd_flags}
-fi
+echo -n 'starting network daemons:'
-if [ X"${dhcrelay_flags}" != X"NO" ]; then
- echo -n ' dhcrelay'; /usr/sbin/dhcrelay $dhcrelay_flags
-fi
+start_daemon sshd snmpd ldpd ripd bgpd ifstated relayd dhcpd \
+ dhcrelay mrouted dvmrpd
if ifconfig lo0 inet6 >/dev/null 2>&1; then
fw=`sysctl -n net.inet6.ip6.forwarding`
if [ X"${fw}" = X"0" ]; then
- if [ X"${rtsold_flags}" != X"NO" ]; then
- echo -n ' rtsold'
- /usr/sbin/rtsold ${rtsold_flags}
- fi
+ start_daemon rtsold
else
- if [ X"${route6d_flags}" != X"NO" ]; then
- echo -n ' route6d'
- /usr/sbin/route6d ${route6d_flags}
- fi
- if [ X"${rtadvd_flags}" != X"NO" ]; then
- echo -n ' rtadvd'
- /usr/sbin/rtadvd ${rtadvd_flags}
- fi
+ start_daemon route6d
+ start_daemon rtadvd
fi
fi
-if [ X"${hostapd_flags}" != X"NO" ]; then
- echo -n ' hostapd'; /usr/sbin/hostapd ${hostapd_flags}
-fi
+start_daemon hostapd rwhod lpd ldapd sendmail smtpd httpd ftpd \
+ ftpproxy identd inetd rarpd bootparamd rbootd mopd
if [ X"${bt}" != X"NO" ]; then
echo -n ' btd'; /usr/sbin/btd
@@ -704,52 +613,6 @@ if [ X"${bt}" != X"NO" ]; then
fi
fi
-if [ X"${rwhod}" = X"YES" ]; then
- echo -n ' rwhod'; rwhod
-fi
-
-
-if [ X"${lpd_flags}" != X"NO" ]; then
- echo -n ' lpd'; lpd ${lpd_flags}
-fi
-
-if [ X"${ldapd_flags}" != X"NO" ]; then
- echo -n ' ldapd'; /usr/sbin/ldapd ${ldapd_flags}
-fi
-
-# We call sendmail with a full path so that SIGHUP works.
-# Note that /usr/sbin/sendmail may actually call a
-# mailer other than sendmail, depending on /etc/mailer.conf.
-if [ X"${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then
- echo -n ' sendmail'; ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & )
-fi
-
-if [ X"${smtpd_flags}" != X"NO" ]; then
- echo -n ' smtpd'; smtpd $smtpd_flags
-fi
-
-if [ X"${httpd_flags}" != X"NO" ]; then
- # Clean up left-over httpd locks
- rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
- echo -n ' httpd'; /usr/sbin/httpd ${httpd_flags}
-fi
-
-if [ X"${ftpd_flags}" != X"NO" ]; then
- echo -n ' ftpd'; /usr/libexec/ftpd ${ftpd_flags}
-fi
-
-if [ X"${ftpproxy_flags}" != X"NO" ]; then
- echo -n ' ftp-proxy'; /usr/sbin/ftp-proxy ${ftpproxy_flags}
-fi
-
-if [ X"${identd_flags}" != X"NO" ]; then
- echo -n ' identd'; /usr/libexec/identd ${identd_flags}
-fi
-
-if [ X"${inetd}" = X"YES" -a -e /etc/inetd.conf ]; then
- echo -n ' inetd'; inetd
-fi
-
if [ X"${spamd_flags}" != X"NO" ]; then
if [ X"${spamd_black}" != X"NO" ]; then
spamd_flags="${spamd_flags} -b"
@@ -762,22 +625,6 @@ if [ X"${spamd_flags}" != X"NO" ]; then
fi
fi
-if [ X"${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then
- echo -n ' rarpd'; rarpd ${rarpd_flags}
-fi
-
-if [ X"${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then
- echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags}
-fi
-
-if [ X"${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then
- echo -n ' rbootd'; rbootd ${rbootd_flags}
-fi
-
-if [ X"${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
- echo -n ' mopd'; mopd ${mopd_flags}
-fi
-
echo '.'
mixerctl_conf
@@ -819,25 +666,9 @@ fi
[ -f /etc/rc.local ] && . /etc/rc.local
-echo -n starting standard daemons:
-
-if [ X"${apmd_flags}" != X"NO" -a -x /usr/sbin/apmd ]; then
- echo -n ' apmd'; /usr/sbin/apmd ${apmd_flags}
-fi
-
-if [ X"${sensorsd_flags}" != X"NO" ]; then
- echo -n ' sensorsd'; /usr/sbin/sensorsd ${sensorsd_flags}
-fi
-
-if [ X"${hotplugd_flags}" != X"NO" -a -x /usr/sbin/hotplugd ]; then
- echo -n ' hotplugd'; /usr/sbin/hotplugd ${hotplugd_flags}
-fi
-
-if [ X"${watchdogd_flags}" != X"NO" -a -x /usr/sbin/watchdogd ]; then
- echo -n ' watchdogd'; /usr/sbin/watchdogd ${watchdogd_flags}
-fi
+echo -n 'starting standard daemons:'
-echo -n ' cron'; cron
+start_daemon apmd sensorsd hotplugd watchdogd cron
# disable carp interlock
ifconfig -g carp -carpdemote 128
diff --git a/etc/rc.conf b/etc/rc.conf
index f582257157b..f95a50e9f5e 100644
--- a/etc/rc.conf
+++ b/etc/rc.conf
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: rc.conf,v 1.141 2011/02/12 11:21:01 ajacoutot Exp $
+# $OpenBSD: rc.conf,v 1.142 2011/07/06 18:55:36 robert Exp $
# set these to "NO" to turn them off. otherwise, they're used as flags
ldpd_flags=NO # for normal use: ""
@@ -47,6 +47,8 @@ snmpd_flags=NO # for normal use: ""
smtpd_flags=NO # for normal use: ""
aucat_flags=NO # for normal use: ""
ldapd_flags=NO # for normal use: ""
+inetd_flags="" # for normal use: ""
+rwhod_flags=NO # for normal use: ""
# use -u to disable chroot, see httpd(8)
httpd_flags=NO # for normal use: "" (or "-DSSL" after reading ssl(8))
@@ -70,7 +72,6 @@ xdm_flags=NO # for normal use: ""
wsmoused_flags=NO # for ps/2 or usb mice: "", serial: "-p /dev/cua00"
# set the following to "YES" to turn them on
-rwhod=NO
nfs_server=NO # see sysctl.conf for nfs client configuration
lockd=NO
amd=NO
@@ -78,7 +79,6 @@ pf=YES # Packet filter / NAT
ipsec=NO # IPsec
bt=NO # Bluetooth
portmap=NO # Note: inetd(8) rpc services need portmap too
-inetd=YES # almost always needed
check_quotas=YES # NO may be desirable in some YP environments
accounting=NO # process accounting (using /var/account/acct)
@@ -113,4 +113,10 @@ rc_scripts=
local_rcconf="/etc/rc.conf.local"
+unset inetd_flags rwhod_flags
+
[ -f ${local_rcconf} ] && . ${local_rcconf} # Do not edit this line
+
+# backward compatibility for inetd and rwhod
+: ${inetd_flags=$([ X"${inetd-YES}" = XYES ] || echo NO)}
+: ${rwhod_flags=$([ X"${rwhod-NO}" = XYES ] || echo NO)}
diff --git a/etc/rc.d/apmd b/etc/rc.d/apmd
new file mode 100644
index 00000000000..455f3a10e66
--- /dev/null
+++ b/etc/rc.d/apmd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: apmd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/apmd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/bgpd b/etc/rc.d/bgpd
new file mode 100644
index 00000000000..48a09f3cad8
--- /dev/null
+++ b/etc/rc.d/bgpd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: bgpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/bgpd"
+
+. /etc/rc.d/rc.subr
+
+pexp="bgpd: parent.*"
+
+rc_cmd $1
diff --git a/etc/rc.d/bootparamd b/etc/rc.d/bootparamd
new file mode 100644
index 00000000000..e3f45a505be
--- /dev/null
+++ b/etc/rc.d/bootparamd
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $OpenBSD: bootparamd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/rpc.bootparamd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_pre() {
+ [ -s /etc/bootparams ] || return 1
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/cron b/etc/rc.d/cron
new file mode 100644
index 00000000000..347d7d07a90
--- /dev/null
+++ b/etc/rc.d/cron
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: cron,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/cron"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd
new file mode 100644
index 00000000000..c3a94241d77
--- /dev/null
+++ b/etc/rc.d/dhcpd
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $OpenBSD: dhcpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/dhcpd"
+
+. /etc/rc.d/rc.subr
+
+rc_pre() {
+ touch /var/db/dhcpd.leases
+}
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay
new file mode 100644
index 00000000000..d692b695fb8
--- /dev/null
+++ b/etc/rc.d/dhcrelay
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: dhcrelay,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/dhcrelay"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/dvmrpd b/etc/rc.d/dvmrpd
new file mode 100644
index 00000000000..948b28932b1
--- /dev/null
+++ b/etc/rc.d/dvmrpd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: dvmrpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/dvmrpd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/ftpd b/etc/rc.d/ftpd
new file mode 100644
index 00000000000..2ea6bf1a78c
--- /dev/null
+++ b/etc/rc.d/ftpd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: ftpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/libexec/ftpd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/ftpproxy b/etc/rc.d/ftpproxy
new file mode 100644
index 00000000000..1dc8897544d
--- /dev/null
+++ b/etc/rc.d/ftpproxy
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: ftpproxy,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/ftp-proxy"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/hostapd b/etc/rc.d/hostapd
new file mode 100644
index 00000000000..0e4d8783617
--- /dev/null
+++ b/etc/rc.d/hostapd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: hostapd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/hostapd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/hotplugd b/etc/rc.d/hotplugd
new file mode 100644
index 00000000000..b443e13ae42
--- /dev/null
+++ b/etc/rc.d/hotplugd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: hotplugd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/hotplugd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/httpd b/etc/rc.d/httpd
new file mode 100644
index 00000000000..0dcf1c6a69e
--- /dev/null
+++ b/etc/rc.d/httpd
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $OpenBSD: httpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/httpd"
+
+. /etc/rc.d/rc.subr
+
+pexp="httpd: parent.*"
+
+rc_pre() {
+ rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/identd b/etc/rc.d/identd
new file mode 100644
index 00000000000..aa21dfb0078
--- /dev/null
+++ b/etc/rc.d/identd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: identd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/libexec/identd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/ifstated b/etc/rc.d/ifstated
new file mode 100644
index 00000000000..e05607ddffe
--- /dev/null
+++ b/etc/rc.d/ifstated
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: ifstated,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/ifstated"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/iked b/etc/rc.d/iked
new file mode 100644
index 00000000000..b564c182435
--- /dev/null
+++ b/etc/rc.d/iked
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $OpenBSD: iked,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/sbin/iked"
+
+. /etc/rc.d/rc.subr
+
+pexp="iked:.*parent.*"
+
+rc_pre() {
+ [ X"${sasyncd_flags}" != X"NO" ] && \
+ daemon_flags="-S ${daemon_flags}"
+ return 0
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/inetd b/etc/rc.d/inetd
new file mode 100644
index 00000000000..d13ea54f503
--- /dev/null
+++ b/etc/rc.d/inetd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: inetd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/inetd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/isakmpd b/etc/rc.d/isakmpd
new file mode 100644
index 00000000000..33eb2078f6e
--- /dev/null
+++ b/etc/rc.d/isakmpd
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $OpenBSD: isakmpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/sbin/isakmpd"
+
+. /etc/rc.d/rc.subr
+
+pexp="isakmpd: monitor \[priv\]"
+
+rc_pre() {
+ [ X"${sasyncd_flags}" != X"NO" ] && \
+ daemon_flags="-S ${daemon_flags}"
+ return 0
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/ldapd b/etc/rc.d/ldapd
new file mode 100644
index 00000000000..0bf911fe363
--- /dev/null
+++ b/etc/rc.d/ldapd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: ldapd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/ldapd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/ldattach b/etc/rc.d/ldattach
new file mode 100644
index 00000000000..39d520aeb90
--- /dev/null
+++ b/etc/rc.d/ldattach
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $OpenBSD: ldattach,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/sbin/ldattach"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_pre() {
+ [ -n "${ldattach_flags}" ] || return 1
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/ldpd b/etc/rc.d/ldpd
new file mode 100644
index 00000000000..9ea10b42864
--- /dev/null
+++ b/etc/rc.d/ldpd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: ldpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/ldpd"
+
+. /etc/rc.d/rc.subr
+
+pexp="ldpd: parent.*"
+
+rc_cmd $1
diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd
new file mode 100644
index 00000000000..c80ec954ed2
--- /dev/null
+++ b/etc/rc.d/lpd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: lpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/lpd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/mopd b/etc/rc.d/mopd
new file mode 100644
index 00000000000..cf46ddae78b
--- /dev/null
+++ b/etc/rc.d/mopd
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $OpenBSD: mopd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/mopd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_pre() {
+ [ -d /tftpboot/mop ] || return 1
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/mrouted b/etc/rc.d/mrouted
new file mode 100644
index 00000000000..fd31f2427b8
--- /dev/null
+++ b/etc/rc.d/mrouted
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: mrouted,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/mrouted"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/named b/etc/rc.d/named
new file mode 100644
index 00000000000..c7b3cbf2e1d
--- /dev/null
+++ b/etc/rc.d/named
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: named,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/named"
+
+. /etc/rc.d/rc.subr
+
+pexp="named: \[priv\]"
+
+rc_cmd $1
diff --git a/etc/rc.d/nsd b/etc/rc.d/nsd
new file mode 100644
index 00000000000..ecf2f80dc22
--- /dev/null
+++ b/etc/rc.d/nsd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: nsd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/nsd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd
new file mode 100644
index 00000000000..22dd81379ae
--- /dev/null
+++ b/etc/rc.d/ntpd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: ntpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/ntpd"
+
+. /etc/rc.d/rc.subr
+
+pexp="ntpd: \[priv\]"
+
+rc_cmd $1
diff --git a/etc/rc.d/rarpd b/etc/rc.d/rarpd
new file mode 100644
index 00000000000..82a8ac77eaf
--- /dev/null
+++ b/etc/rc.d/rarpd
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $OpenBSD: rarpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/rarpd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_pre() {
+ [ -s /etc/ethers ] || return 1
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/rbootd b/etc/rc.d/rbootd
new file mode 100644
index 00000000000..9135a368ecf
--- /dev/null
+++ b/etc/rc.d/rbootd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: rbootd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/rbootd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index 8f6b33e6cca..837d95809c9 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.39 2011/07/03 16:09:06 schwarze Exp $
+# $OpenBSD: rc.subr,v 1.40 2011/07/06 18:55:36 robert Exp $
# Default functions and variables used by rc.d(8) scripts.
@@ -74,7 +74,7 @@ rc_cmd() {
rc_do rc_check
;;
start)
- rc_do rc_check && exit 0
+ [ -z "${INRC}" ] && rc_do rc_check && exit 0
while true; do # no real loop, only needed to break
if type rc_pre >/dev/null; then
rc_do rc_pre || break
diff --git a/etc/rc.d/relayd b/etc/rc.d/relayd
new file mode 100644
index 00000000000..6c73c12b166
--- /dev/null
+++ b/etc/rc.d/relayd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: relayd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/relayd"
+
+. /etc/rc.d/rc.subr
+
+pexp="relayd: parent.*"
+
+rc_cmd $1
diff --git a/etc/rc.d/ripd b/etc/rc.d/ripd
new file mode 100644
index 00000000000..8eec73703d4
--- /dev/null
+++ b/etc/rc.d/ripd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: ripd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/ripd"
+
+. /etc/rc.d/rc.subr
+
+pexp="ripd: parent.*"
+
+rc_cmd $1
diff --git a/etc/rc.d/route6d b/etc/rc.d/route6d
new file mode 100644
index 00000000000..1b1824b41a6
--- /dev/null
+++ b/etc/rc.d/route6d
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: route6d,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/route6d"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/rtadvd b/etc/rc.d/rtadvd
new file mode 100644
index 00000000000..fc0df45e589
--- /dev/null
+++ b/etc/rc.d/rtadvd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: rtadvd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/rtadvd"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/rtsold b/etc/rc.d/rtsold
new file mode 100644
index 00000000000..1de730ff629
--- /dev/null
+++ b/etc/rc.d/rtsold
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: rtsold,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/rtsold"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/rwhod b/etc/rc.d/rwhod
new file mode 100644
index 00000000000..b6f246c9bb8
--- /dev/null
+++ b/etc/rc.d/rwhod
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: rwhod,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/rwhod"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/sasyncd b/etc/rc.d/sasyncd
new file mode 100644
index 00000000000..3a12dc11077
--- /dev/null
+++ b/etc/rc.d/sasyncd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: sasyncd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/sasyncd"
+
+. /etc/rc.d/rc.subr
+
+pexp="sasyncd: \[priv\]"
+
+rc_cmd $1
diff --git a/etc/rc.d/sendmail b/etc/rc.d/sendmail
new file mode 100644
index 00000000000..65450e39ce2
--- /dev/null
+++ b/etc/rc.d/sendmail
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: sendmail,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/sendmail"
+
+. /etc/rc.d/rc.subr
+
+pexp="sendmail: accepting.*"
+
+rc_cmd $1
diff --git a/etc/rc.d/sensorsd b/etc/rc.d/sensorsd
new file mode 100644
index 00000000000..9ac16e22cb6
--- /dev/null
+++ b/etc/rc.d/sensorsd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: sensorsd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/sensorsd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/smtpd b/etc/rc.d/smtpd
new file mode 100644
index 00000000000..122a76d475b
--- /dev/null
+++ b/etc/rc.d/smtpd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: smtpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/smtpd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/snmpd b/etc/rc.d/snmpd
new file mode 100644
index 00000000000..a3648d592f0
--- /dev/null
+++ b/etc/rc.d/snmpd
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: snmpd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/snmpd"
+
+. /etc/rc.d/rc.subr
+
+pexp="snmpd: parent.*"
+
+rc_cmd $1
diff --git a/etc/rc.d/sshd b/etc/rc.d/sshd
new file mode 100644
index 00000000000..46aef9085b0
--- /dev/null
+++ b/etc/rc.d/sshd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: sshd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/sshd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd
new file mode 100644
index 00000000000..8f82c846e59
--- /dev/null
+++ b/etc/rc.d/syslogd
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# $OpenBSD: syslogd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/syslogd"
+
+. /etc/rc.d/rc.subr
+
+pexp="syslogd: \[priv\]"
+
+rc_pre() {
+ [ X"${httpd_flags}" != X"-u" ] && rm -f /var/www/dev/log && \
+ daemon_flags="${daemon_flags} -a /var/www/dev/log"
+ [ X"${named_flags}" != X"NO" ] && rm -f /var/named/dev/log && \
+ daemon_flags="${daemon_flags} -a /var/named/dev/log"
+ [ X"${nsd_flags}" != X"NO" ] && rm -f /var/nsd/dev/log && \
+ daemon_flags="${daemon_flags} -a /var/nsd/dev/log"
+ [ -d /var/empty ] && rm -f /var/empty/dev/log && \
+ mkdir -p -m 0555 /var/empty/dev && \
+ daemon_flags="${daemon_flags} -a /var/empty/dev/log"
+ rm -f /dev/log
+}
+
+rc_cmd $1
diff --git a/etc/rc.d/timed b/etc/rc.d/timed
new file mode 100644
index 00000000000..b0e7b214489
--- /dev/null
+++ b/etc/rc.d/timed
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# $OpenBSD: timed,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/timed"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1
diff --git a/etc/rc.d/watchdogd b/etc/rc.d/watchdogd
new file mode 100644
index 00000000000..5a4321861b4
--- /dev/null
+++ b/etc/rc.d/watchdogd
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# $OpenBSD: watchdogd,v 1.1 2011/07/06 18:55:36 robert Exp $
+
+daemon="/usr/sbin/watchdogd"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1