1#!/bin/sh
2#
3# $FreeBSD: head/etc/rc.d/bgfsck 273013 2014-10-12 22:11:28Z hrs $
4#
5
6# PROVIDE: bgfsck
7# REQUIRE: cron devfs syslogd
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="background_fsck"
13rcvar="background_fsck"
14start_cmd="bgfsck_start"
15stop_cmd=":"
16
17bgfsck_start()
18{
19 if [ -z "${rc_force}" ]; then
20 background_fsck_delay=${background_fsck_delay:-0}
21 else
22 background_fsck_delay=0
23 fi
24 if [ ${background_fsck_delay} -lt 0 ]; then
25 echo "Background file system checks delayed indefinitely"
26 return 0
27 fi
28
29 bgfsck_msg='Starting background file system checks'
30 if [ "${background_fsck_delay}" -gt 0 ]; then
31 bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
32 fi
33 if [ -z "${rc_force}" ]; then
34 check_startmsgs && echo "${bgfsck_msg}."
35 fi
36
37 (sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \
38 logger -p daemon.notice -t fsck &
39}
40
41load_rc_config $name
42run_rc_command "$1"
2#
3# $FreeBSD: head/etc/rc.d/bgfsck 273013 2014-10-12 22:11:28Z hrs $
4#
5
6# PROVIDE: bgfsck
7# REQUIRE: cron devfs syslogd
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12name="background_fsck"
13rcvar="background_fsck"
14start_cmd="bgfsck_start"
15stop_cmd=":"
16
17bgfsck_start()
18{
19 if [ -z "${rc_force}" ]; then
20 background_fsck_delay=${background_fsck_delay:-0}
21 else
22 background_fsck_delay=0
23 fi
24 if [ ${background_fsck_delay} -lt 0 ]; then
25 echo "Background file system checks delayed indefinitely"
26 return 0
27 fi
28
29 bgfsck_msg='Starting background file system checks'
30 if [ "${background_fsck_delay}" -gt 0 ]; then
31 bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
32 fi
33 if [ -z "${rc_force}" ]; then
34 check_startmsgs && echo "${bgfsck_msg}."
35 fi
36
37 (sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \
38 logger -p daemon.notice -t fsck &
39}
40
41load_rc_config $name
42run_rc_command "$1"