xref: /freebsd/usr.sbin/periodic/etc/daily/430.status-uptime (revision 643ac419fafba89f5adda0e0ea75b538727453fb)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# If there is a global system configuration file, suck it in.
7#
8if [ -r /etc/defaults/periodic.conf ]
9then
10    . /etc/defaults/periodic.conf
11    source_periodic_confs
12fi
13
14case "$daily_status_uptime_enable" in
15    [Yy][Ee][Ss])
16	rwho=$(echo /var/rwho/*)
17        if [ -f "${rwho%% *}" ]
18        then
19	    echo ""
20	    echo "Local network system status:"
21	    prog=ruptime
22	else
23	    echo ""
24	    echo "Local system status:"
25	    prog=uptime
26	fi
27	rc=$($prog | tee /dev/stderr | wc -l)
28	if [ $? -eq 0 ]
29	then
30	    [ $rc -gt 1 ] && rc=1
31	else
32	    rc=3
33	fi;;
34
35    *)  rc=0;;
36esac
37
38exit $rc
39