diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-07-12 07:52:42 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-07-12 07:52:42 +0100 |
| commit | 799dc834e0fe94ed62c0d6bb65e6d15a639ab668 (patch) | |
| tree | bb3b7a89764f768b6b1c4a4918e9eb37a88645b8 /chrony.sh | |
| download | lfldap-799dc834e0fe94ed62c0d6bb65e6d15a639ab668.tar.gz lfldap-799dc834e0fe94ed62c0d6bb65e6d15a639ab668.tar.bz2 | |
initial commitv1.0
Diffstat (limited to 'chrony.sh')
| -rw-r--r-- | chrony.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/chrony.sh b/chrony.sh new file mode 100644 index 0000000..b91a5c3 --- /dev/null +++ b/chrony.sh @@ -0,0 +1,27 @@ +# This source code is released into the public domain. +# +# The chrony.allow file is a list of "allow <prefix>", one per line, +# no traiing semicolon. chrony doesn't have a simple way to reload +# its configuration file, so we just restart it. A better way might +# be to use "chronyc allow" to update it on the fly. + +CHRONY_FILE="/usr/local/etc/chrony.allow" +CHRONY_TEMP="${CHRONY_FILE}.ldaptmp" + +if [ ! -f "$CHRONY_FILE" ]; then + exit 0 +fi + +awk <"$NETWORKS_FILE" >"$CHRONY_TEMP" '{ print "allow " $1 }' + +if cmp -s "$CHRONY_TEMP" "$CHRONY_FILE"; then + rm "$CHRONY_TEMP" + exit 0 +fi + +printf '%s updated:\n\n' "$CHRONY_FILE" +diff "$CHRONY_FILE" "$CHRONY_TEMP" +printf '\n' + +mv "$CHRONY_TEMP" "$CHRONY_FILE" +/usr/local/etc/rc.d/chronyd restart |
