39 lines
918 B
Bash
Executable File
39 lines
918 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Load configuration
|
|
CONFIG_FILE="${CONFIG_FILE:-config.local.env}"
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
|
CONFIG_FILE="config.env"
|
|
fi
|
|
|
|
if [ ! -f "$CONFIG_FILE" ]; then
|
|
echo "ERROR: Configuration file not found. Please create config.local.env or config.env"
|
|
exit 1
|
|
fi
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$CONFIG_FILE"
|
|
|
|
echo "Applying rsyslog config from git repo..."
|
|
echo " Main config: $GIT_RSYSLOG_MAIN_CONFIG → $RSYSLOG_MAIN_CONFIG"
|
|
echo " Config dir: $GIT_RSYSLOG_CONFIG_DIR → $RSYSLOG_CONFIG_DIR"
|
|
|
|
if [ ! -f "$GIT_RSYSLOG_MAIN_CONFIG" ]; then
|
|
echo "ERROR: Source file not found: $GIT_RSYSLOG_MAIN_CONFIG"
|
|
exit 1
|
|
fi
|
|
|
|
cp "$GIT_RSYSLOG_MAIN_CONFIG" "$RSYSLOG_MAIN_CONFIG"
|
|
mkdir -p "$RSYSLOG_CONFIG_DIR"
|
|
cp "$GIT_RSYSLOG_CONFIG_DIR"/*.conf "$RSYSLOG_CONFIG_DIR/"
|
|
|
|
echo "Validating config..."
|
|
rsyslogd -N1
|
|
|
|
echo "Restarting rsyslog..."
|
|
systemctl restart rsyslog
|
|
|
|
echo "Done."
|
|
|