Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/newsyslog
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# $FreeBSD$ | # $FreeBSD$ | ||||
# | # | ||||
# PROVIDE: newsyslog | # PROVIDE: newsyslog | ||||
# REQUIRE: FILESYSTEMS mountcritremote | # REQUIRE: FILESYSTEMS mountcritremote | ||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="newsyslog" | name="newsyslog" | ||||
desc="Logfile rotation" | desc="Logfile rotation" | ||||
rcvar="newsyslog_enable" | rcvar="newsyslog_enable" | ||||
required_files="/etc/newsyslog.conf" | required_files="/etc/newsyslog.conf" | ||||
command="/usr/sbin/${name}" | command="/usr/sbin/${name}" | ||||
start_cmd="newsyslog_start" | start_cmd="newsyslog_start" | ||||
start_precmd="newsyslog_prestart" | |||||
stop_cmd=":" | stop_cmd=":" | ||||
newsyslog_prestart() | |||||
{ | |||||
excludedfiles=$( find -E /etc/newsyslog.conf.d/ /usr/local/etc/newsyslog.conf.d/ \ | |||||
\( -type f \) -and \ | |||||
\( -name ".*" -or -not -name "*.conf" \) -and \ | |||||
-not \( -regex ".*\.(sample|bak|orig|rej)" \) ) | |||||
if [ -n "${excludedfiles}" ]; then | |||||
echo "********************** WARNING from newsyslog(8) **********************" | |||||
echo "The following files start with '.' or do not end with '.conf'" | |||||
echo "and therefore will not be included by the default newsyslog.conf(5):" | |||||
echo "${excludedfiles}" | |||||
echo "***********************************************************************" | |||||
fi | |||||
} | |||||
newsyslog_start() | newsyslog_start() | ||||
{ | { | ||||
check_startmsgs && echo -n 'Creating and/or trimming log files' | check_startmsgs && echo -n 'Creating and/or trimming log files' | ||||
${command} ${rc_flags} | ${command} ${rc_flags} | ||||
check_startmsgs && echo '.' | check_startmsgs && echo '.' | ||||
} | } | ||||
load_rc_config $name | load_rc_config $name | ||||
run_rc_command "$1" | run_rc_command "$1" |