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