[PATCH] Don't test if a service is enabled when it's required
Xin LI
delphij at delphij.net
Sun Aug 21 07:38:13 UTC 2011
Hi,
Currently we do a checkyesno before doing forcestatus on a service that
is required. However, this way if a dependent service is enabled but
stopped, it would not be started.
For instance:
echo 'mountd_enable="YES"' >> /etc/rc.conf
/etc/rc.d/mountd stop
/etc/rc.d/nfsd stop
/etc/rc.d/nfsd start
Would not start mountd.
I'd like to propose the attached patch since it doesn't seem to be
necessary that we test the enable status before doing forcestatus.
Comments?
Cheers,
--
Xin LI <delphij at delphij.net> https://www.delphij.net/
FreeBSD - The Power to Serve! Live free or die
-------------- next part --------------
Index: amd
===================================================================
--- amd (revision 225055)
+++ amd (working copy)
@@ -23,8 +23,7 @@
force_depend nfsclient || return 1
fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
Index: ypset
===================================================================
--- ypset (revision 225055)
+++ ypset (working copy)
@@ -20,13 +20,11 @@
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
- if ! checkyesno nis_client_enable && \
- ! /etc/rc.d/ypbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/ypbind forcestatus 1>/dev/null 2>&1
then
force_depend ypbind || return 1
fi
Index: mountd
===================================================================
--- mountd (revision 225055)
+++ mountd (working copy)
@@ -19,8 +19,7 @@
mountd_precmd()
{
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
Index: yppasswdd
===================================================================
--- yppasswdd (revision 225055)
+++ yppasswdd (working copy)
@@ -22,13 +22,11 @@
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
- if ! checkyesno nis_server_enable && \
- ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
then
force_depend ypserv || return 1
fi
Index: keyserv
===================================================================
--- keyserv (revision 225055)
+++ keyserv (working copy)
@@ -19,8 +19,7 @@
keyserv_prestart()
{
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
Index: ypupdated
===================================================================
--- ypupdated (revision 225055)
+++ ypupdated (working copy)
@@ -18,13 +18,11 @@
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
- if ! checkyesno nis_server_enable && \
- ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
then
force_depend ypserv || return 1
fi
Index: apmd
===================================================================
--- apmd (revision 225055)
+++ apmd (working copy)
@@ -19,9 +19,8 @@
{
case `${SYSCTL_N} hw.machine_arch` in
i386)
- # Enable apm if it is not already enabled
- if ! checkyesno apm_enable && \
- ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
+ # Start apm in case it was not already
+ if ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
then
force_depend apm || return 1
fi
Index: nfsd
===================================================================
--- nfsd (revision 225055)
+++ nfsd (working copy)
@@ -43,8 +43,7 @@
fi
if checkyesno nfsv4_server_enable; then
- if ! checkyesno nfsuserd_enable && \
- ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/nfsuserd forcestatus 1>/dev/null 2>&1
then
if ! force_depend nfsuserd; then
err 1 "Cannot run nfsuserd"
@@ -56,14 +55,12 @@
fi
fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
- if ! checkyesno mountd_enable && \
- ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
then
force_depend mountd || return 1
fi
Index: lockd
===================================================================
--- lockd (revision 225055)
+++ lockd (working copy)
@@ -30,8 +30,7 @@
then
ret=1
fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || ret=1
fi
Index: statd
===================================================================
--- statd (revision 225055)
+++ statd (working copy)
@@ -30,8 +30,7 @@
then
ret=1
fi
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || ret=1
fi
Index: ypbind
===================================================================
--- ypbind (revision 225055)
+++ ypbind (working copy)
@@ -22,8 +22,7 @@
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
Index: ypserv
===================================================================
--- ypserv (revision 225055)
+++ ypserv (working copy)
@@ -21,8 +21,7 @@
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
Index: ypxfrd
===================================================================
--- ypxfrd (revision 225055)
+++ ypxfrd (working copy)
@@ -20,13 +20,11 @@
{
local _domain
- if ! checkyesno rpcbind_enable && \
- ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
then
force_depend rpcbind || return 1
fi
- if ! checkyesno nis_server_enable && \
- ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
+ if ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
then
force_depend ypserv || return 1
fi
More information about the freebsd-rc
mailing list