Files
basementhud/rootfs/overlay/usr/lib/dhcpcd/dhcpcd-hooks/60-syslog
Dustin C. Hatch 778fb9ec7b
Some checks are pending
basementhud/pipeline/head This commit looks good
fedora-pi-netboot/pipeline/head Build started...
Initial commit
2022-03-19 09:58:56 -05:00

32 lines
860 B
Bash

#!/bin/sh
gen_action() {
echo 'action('
echo ' type="omfwd"'
printf ' Target="%s"\n' "${1}"
echo ' Port="514"'
echo ' template="RSYSLOG_SyslogProtocol23Format"'
echo ')'
}
changed=false
if [ -n "${interface}" ] && [ -d /run/rsyslog.d ]; then
if [ -n "${new_log_servers}" ]; then
if [ "${new_log_servers}" != "${old_log_servers}" ]; then
echo '# Generated by dhcpcd' \
> /run/rsyslog.d/dhcpcd."${interface}".conf
for s in ${new_log_servers}; do
gen_action "${s}" >> /run/rsyslog.d/dhcpcd."${interface}".conf
done
fi
changed=true
elif [ -n "${old_log_servers}" ]; then
rm -f /run/rsyslog.d/dhcpcd."${interface}".conf
changed=true
fi
fi
if ${changed}; then
systemctl try-restart rsyslog
fi