2002-06-13 22:14:37 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: bgfsck
|
2005-07-22 00:57:37 +00:00
|
|
|
# REQUIRE: cron devfs syslogd
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2002-06-13 22:14:37 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="background-fsck"
|
|
|
|
rcvar="background_fsck"
|
2002-12-18 07:21:31 +00:00
|
|
|
start_cmd="bgfsck_start"
|
2002-06-13 22:14:37 +00:00
|
|
|
stop_cmd=":"
|
|
|
|
|
2002-12-18 07:21:31 +00:00
|
|
|
bgfsck_start ()
|
|
|
|
{
|
2007-03-11 06:53:07 +00:00
|
|
|
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
|
|
|
|
|
2002-12-18 07:21:31 +00:00
|
|
|
bgfsck_msg='Starting background file system checks'
|
2007-03-11 06:53:07 +00:00
|
|
|
if [ "${background_fsck_delay}" -gt 0 ]; then
|
2002-12-18 07:21:31 +00:00
|
|
|
bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
|
|
|
|
fi
|
2007-03-11 06:53:07 +00:00
|
|
|
if [ -z "${rc_force}" ]; then
|
2008-06-23 04:46:54 +00:00
|
|
|
[ -z "${rc_quiet}" ] && echo "${bgfsck_msg}."
|
2007-03-11 06:53:07 +00:00
|
|
|
fi
|
2002-12-18 07:21:31 +00:00
|
|
|
|
|
|
|
(sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \
|
2003-04-23 15:38:02 +00:00
|
|
|
logger -p daemon.notice -t fsck &
|
2002-12-18 07:21:31 +00:00
|
|
|
}
|
|
|
|
|
2002-06-13 22:14:37 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|