Page MenuHomeFreeBSD

D7474.diff
No OneTemporary

D7474.diff

Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf
+++ etc/defaults/rc.conf
@@ -255,6 +255,7 @@
### Network daemon (miscellaneous) ###
hostapd_enable="NO" # Run hostap daemon.
syslogd_enable="YES" # Run syslog daemon (or NO).
+syslogd_supervise="NO" # Automatically restart syslogd.
syslogd_program="/usr/sbin/syslogd" # path to syslogd, if you want a different one.
syslogd_flags="-s" # Flags to syslogd (if enabled).
syslogd_oomprotect="YES" # Don't kill syslogd when swap space is exhausted.
@@ -314,6 +315,7 @@
pppoed_flags="-P /var/run/pppoed.pid" # Flags to pppoed (if enabled).
pppoed_interface="fxp0" # The interface that pppoed runs on.
sshd_enable="NO" # Enable sshd
+sshd_supervise="NO" # Automatically restart sshd
sshd_program="/usr/sbin/sshd" # path to sshd, if you want a different one.
sshd_flags="" # Additional flags for sshd.
ftpd_enable="NO" # Enable stand-alone ftpd.
@@ -594,6 +596,7 @@
auditdistd_program="/usr/sbin/auditdistd" # Path to the auditdistd daemon.
auditdistd_flags="" # Which options to pass to the auditdistd daemon.
cron_enable="YES" # Run the periodic job daemon.
+cron_supervise="NO" # Automatically restart cron.
cron_program="/usr/sbin/cron" # Which cron executable to run (if enabled).
cron_dst="YES" # Handle DST transitions intelligently (YES/NO)
cron_flags="" # Which options to pass to the cron daemon.
Index: etc/rc.d/cron
===================================================================
--- etc/rc.d/cron
+++ etc/rc.d/cron
@@ -21,4 +21,11 @@
then
cron_flags="$cron_flags -s"
fi
+if checkyesno cron_supervise
+then
+ procname="daemon"
+ pidfile="/var/run/cron-daemon.pid"
+ cron_daemon="-r -P ${pidfile}"
+ cron_flags="${cron_flags} -n"
+fi
run_rc_command "$1"
Index: etc/rc.d/sshd
===================================================================
--- etc/rc.d/sshd
+++ etc/rc.d/sshd
@@ -85,4 +85,11 @@
}
load_rc_config $name
+if checkyesno sshd_supervise
+then
+ procname="daemon"
+ pidfile="/var/run/sshd-daemon.pid"
+ sshd_daemon="-r -P ${pidfile}"
+ sshd_flags="${sshd_flags} -D"
+fi
run_rc_command "$1"
Index: etc/rc.d/syslogd
===================================================================
--- etc/rc.d/syslogd
+++ etc/rc.d/syslogd
@@ -71,4 +71,11 @@
echo $_socketargs
}
load_rc_config $name
+if checkyesno syslogd_supervise
+then
+ procname="daemon"
+ pidfile="/var/run/syslogd-daemon.pid"
+ syslogd_daemon="-r -P ${pidfile}"
+ syslogd_flags="${syslogd_flags} -F"
+fi
run_rc_command "$1"
Index: etc/rc.subr
===================================================================
--- etc/rc.subr
+++ etc/rc.subr
@@ -746,6 +746,9 @@
# ${name}_chdir n Directory to cd to before running ${command}
# (if not using ${name}_chroot).
#
+# ${name}_daemon n Arguments to pass to daemon(8) before
+# running ${command}.
+#
# ${name}_flags n Arguments to call ${command} with.
# NOTE: $flags from the parent environment
# can be used to override this.
@@ -952,7 +955,7 @@
_group=\$${name}_group _groups=\$${name}_groups \
_fib=\$${name}_fib _env=\$${name}_env \
_prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \
- _oomprotect=\$${name}_oomprotect
+ _oomprotect=\$${name}_oomprotect _daemon=\$${name}_daemon
if [ -n "$_user" ]; then # unset $_user if running as that user
if [ "$_user" = "$(eval $IDCMD)" ]; then
@@ -1044,19 +1047,22 @@
# setup the full command to run
#
check_startmsgs && echo "Starting ${name}."
+ _doit="$command $rc_flags $command_args"
+ if [ -n "$_daemon" ]; then
+ _doit="daemon $_daemon $_doit"
+ fi
if [ -n "$_chroot" ]; then
_doit="\
${_nice:+nice -n $_nice }\
${_fib:+setfib -F $_fib }\
${_env:+env $_env }\
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
-$_chroot $command $rc_flags $command_args"
+$_chroot $_doit"
else
_doit="\
${_chdir:+cd $_chdir && }\
${_fib:+setfib -F $_fib }\
-${_env:+env $_env }\
-$command $rc_flags $command_args"
+${_env:+env $_env } $_doit"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
fi

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 18, 1:12 PM (9 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27709979
Default Alt Text
D7474.diff (4 KB)

Event Timeline