xref: /freebsd/usr.sbin/periodic/etc/daily/130.clean-msgs (revision 190cef3d52236565eb22e18b33e9e865ec634aa3)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5# Remove system	messages
6#
7
8# If there is a global system configuration file, suck it in.
9#
10if [ -r /etc/defaults/periodic.conf ]
11then
12    . /etc/defaults/periodic.conf
13    source_periodic_confs
14fi
15
16case "$daily_clean_msgs_enable" in
17    [Yy][Ee][Ss])
18	if [ ! -d /var/msgs ]
19	then
20	    echo '$daily_clean_msgs_enable is set but /var/msgs' \
21		"doesn't exist"
22	    rc=2
23	else
24	    echo ""
25	    echo "Cleaning out old system announcements:"
26
27	    [ -n "$daily_clean_msgs_days" ] &&
28		arg=-${daily_clean_msgs_days#-} || arg=
29	    msgs -c $arg && rc=0 || rc=3
30	fi;;
31
32    *)  rc=0;;
33esac
34
35exit $rc
36