tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /etc/daily, rc.conf, swap, NTP, NFS



On Sat, Jun 29, 2013 at 11:46 AM, Erik E. Fair <fair%netbsd.org@localhost> 
wrote:
> Let me try that diff again, MIME-less:
>
> *** daily.orig  2013-06-03 22:27:59.000000000 -0700
> --- daily       2013-06-29 08:32:13.000000000 -0700
> ***************
> *** 26,31 ****
> --- 26,38 ----
>         exit 1;
>   fi
>
> + if [ -f /etc/rc.conf ]; then
> +       . /etc/rc.conf
> + else
> +       echo "Can't read /etc/rc.conf; aborting."
> +       exit 1;
> + fi
> +
>   if [ -z "$MAILTO" -o "$USER" != "root" ]; then
>         MAILTO=root
>   fi
> ***************
> *** 183,188 ****
> --- 190,201 ----
>                 fi
>                 echo ""
>         fi
> +       if checkyesno no_swap; then
> +       else
> +               echo ""
> +               echo "swap space:"
> +               pstat -sh
> +       fi
>         rm -f $TMP $TMP2
>         touch $TMP2
>         for dev in $(iostat -x | awk '/^raid/ { print $1 }'); do
> ***************
> *** 200,216 ****
>         rm -f $TMP2
>   fi
>
> - if checkyesno check_mailq; then
> -       mailq > $TMP
> -       if ! grep -q "queue is empty$" $TMP; then
> -               echo ""
> -               echo "mail:"
> -               cat $TMP
> -       fi
> - fi
> -
> - rm -f $TMP
> -
>   if checkyesno check_network; then
>         echo ""
>         echo "network:"
> --- 213,218 ----
> ***************
> *** 233,245 ****
>                         }
>                 }'
>         fi
> !       echo ""
> !       t=/var/rwho/*
> !       if [ "$t" != '/var/rwho/*' ]; then
>                 ruptime
>         fi
>   fi
>
>   if checkyesno run_fsck; then
>         echo ""
>         echo "Checking filesystems:"
> --- 235,278 ----
>                         }
>                 }'
>         fi
> !       if checkyesno rwhod; then
> !               echo ""
>                 ruptime
>         fi
> +       if checkyesno ntpd; then
> +               echo ""
> +               echo "Network Time Protocol (NTP):"
> +               ntpq -p
> +               echo ""
> +               ntptime
> +       fi
> +       if checkyesno nfs_server; then
> +               echo ""
> +               echo "Network File System (NFS) server:"
> +               nfsstat -s
> +       fi
> +       if checkyesno nfs_client; then
> +               echo ""
> +               echo "Network File System (NFS) client:"
> +               nfsstat -c
> +       fi
> +       if checkyesno ipfilter; then
> +               echo ""
> +               ipfstat
> +       fi
>   fi
>
> + if checkyesno check_mailq; then
> +       mailq > $TMP
> +       if ! grep -q "queue is empty$" $TMP; then
> +               echo ""
> +               echo "mail:"
> +               cat $TMP
> +       fi
> + fi
> +
> + rm -f $TMP
> +
>   if checkyesno run_fsck; then
>         echo ""
>         echo "Checking filesystems:"

You don't need to source rc.conf directly since /etc/daily sources rc.subr

Then you can use checkyesno or load_rc_config or load_rc_config_var
depending on what needs checking.


Home | Main Index | Thread Index | Old Index