Skip to content

Instantly share code, notes, and snippets.

@Satys
Created June 15, 2021 05:19
Embed
What would you like to do?
Rsyslog live reloader
inotifywait --quiet --monitor --event CLOSE_WRITE /etc/rsyslog.d/rsyslog.conf \
| while read change; do
echo "[DEBUG] - `(date +%F\ %T)` - rsyslog daemon reload start"
if [ -f /var/run/rsyslogd.pid ] && kill -TERM $(cat /var/run/rsyslogd.pid); then
/usr/sbin/rsyslogd -f /etc/rsyslog.d/rsyslog.conf
else
/usr/sbin/rsyslogd -f /etc/rsyslog.d/rsyslog.conf
fi
echo "[DEBUG] - `(date +%F\ %T)` - rsyslog daemon reload complete"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment