Skip to content

Instantly share code, notes, and snippets.

@Satys
Created June 15, 2021 05:19
Show Gist options
  • Save Satys/a8426c41931f99d04a1169dfed405ed4 to your computer and use it in GitHub Desktop.
Save Satys/a8426c41931f99d04a1169dfed405ed4 to your computer and use it in GitHub Desktop.
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