Files
init.sh/modules/conf_syslog.sh
2022-06-24 17:52:17 +02:00

41 lines
1.2 KiB
Bash

# ------------------------------------------------------------------------------
# Configure Rsyslog
# This file is part of the init.sh project
# Copyright (c) 2019-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# ------------------------------------------------------------------------------
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# https://opensource.org/licenses/BSD-3-Clause
# ------------------------------------------------------------------------------
# Variables:
# * SYSLOG_SRV: the syslog server name
# ------------------------------------------------------------------------------
export VER_conf_syslog="0.0.5"
conf_syslog()
{
local syslogconf=/etc/rsyslog.conf
prnt I "Configuring rsyslog..."
backup_dist $syslogconf
install_file rsyslog.conf $syslogconf
tag_file $syslogconf
sed -i -e "s/@SYSLOG_SRV@/$SYSLOG_SRV/" $syslogconf
svc_restart rsyslog
}
precheck_conf_syslog()
{
if [[ -z $SYSLOG_SRV ]]; then
prnt E "Undeclared syslog server name!"
die 181
else
file_must_exists rsyslog.conf
fi
}
export -f conf_syslog
export -f precheck_conf_syslog
# EOF