aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/rc.d/bgfsck16
-rw-r--r--share/man/man5/rc.conf.59
2 files changed, 23 insertions, 2 deletions
diff --git a/etc/rc.d/bgfsck b/etc/rc.d/bgfsck
index 9f6bc670a822..19ffb714325a 100644
--- a/etc/rc.d/bgfsck
+++ b/etc/rc.d/bgfsck
@@ -16,11 +16,23 @@ stop_cmd=":"
bgfsck_start ()
{
+ if [ -z "${rc_force}" ]; then
+ background_fsck_delay=${background_fsck_delay:=0}
+ else
+ background_fsck_delay=0
+ fi
+ if [ ${background_fsck_delay} -lt 0 ]; then
+ echo "Background file system checks delayed indefinitly"
+ return 0
+ fi
+
bgfsck_msg='Starting background file system checks'
- if [ ${background_fsck_delay:=0} -gt 0 ]; then
+ if [ "${background_fsck_delay}" -gt 0 ]; then
bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
fi
- echo "${bgfsck_msg}."
+ if [ -z "${rc_force}" ]; then
+ echo "${bgfsck_msg}."
+ fi
(sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \
logger -p daemon.notice -t fsck &
diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5
index 53b3dcf78b5d..f471b1ac5d6e 100644
--- a/share/man/man5/rc.conf.5
+++ b/share/man/man5/rc.conf.5
@@ -1384,6 +1384,15 @@ The amount of time in seconds to sleep before starting a background
It defaults to sixty seconds to allow large applications such as
the X server to start before disk I/O bandwidth is monopolized by
.Xr fsck 8 .
+If set to a negative number, the background file system check will be
+delayed indefinitely to allow the administrator to run it at a more
+convenient time.
+For example it may be run from cron by adding a line like
+.Pp
+.Dl 0 4 * * * root /etc/rc.d/bgfsck forcestart
+.Pp
+to
+.Pa /etc/crontab .
.It Va netfs_types
.Pq Vt str
List of file system types that are network-based.