Allow background_fsck_delay to be set to a negative value which delays

the background fsck indefinitely.  This allows the administrator to run
it at a convenient time.  To support running it from cron, the
forcestart argument now causes the fsck to start with no delay and all
output to be suppressed.
This commit is contained in:
Brooks Davis 2007-03-11 06:53:07 +00:00
parent 9672f0230f
commit 0b45d130bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167437
2 changed files with 23 additions and 2 deletions

View File

@ -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 &

View File

@ -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.