diff options
author | hrs <hrs@FreeBSD.org> | 2015-09-10 06:55:28 +0000 |
---|---|---|
committer | hrs <hrs@FreeBSD.org> | 2015-09-10 06:55:28 +0000 |
commit | e9794a49ece88e3c51305068952da218ec28e6c1 (patch) | |
tree | cff92a54c8d7dd7d2d2fb20888ba039c245463a5 /etc/rc.d/bgfsck | |
parent | d69b1ec3e01612b1e0433435469687a13f147711 (diff) | |
download | FreeBSD-src-e9794a49ece88e3c51305068952da218ec28e6c1.zip FreeBSD-src-e9794a49ece88e3c51305068952da218ec28e6c1.tar.gz |
- Add uid check.
- Report delay<0 as a warning.
MFC after: 3 days
Diffstat (limited to 'etc/rc.d/bgfsck')
-rwxr-xr-x | etc/rc.d/bgfsck | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/etc/rc.d/bgfsck b/etc/rc.d/bgfsck index d15744c..c1d1a4d 100755 --- a/etc/rc.d/bgfsck +++ b/etc/rc.d/bgfsck @@ -12,17 +12,24 @@ name="background_fsck" rcvar="background_fsck" start_cmd="bgfsck_start" +start_precmd="bgfsck_start_precmd" stop_cmd=":" +bgfsck_start_precmd() +{ + if [ $($ID -u) != 0 ]; then + err 1 "Must be root." + fi +} + bgfsck_start() { - if [ -z "${rc_force}" ]; then - background_fsck_delay=${background_fsck_delay:-0} - else + : ${background_fsck_delay=0} + if [ -n "${rc_force}" ]; then background_fsck_delay=0 fi if [ ${background_fsck_delay} -lt 0 ]; then - echo "Background file system checks delayed indefinitely" + warn "Background file system checks delayed indefinitely" return 0 fi |