summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-05-16 09:11:29 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-05-16 09:11:29 +0200
commitd92c9038edc12798b6187ec5fe4422b525c3b4d4 (patch)
treec03b8c3cdc3874e99cb7adda52cb9b0386349236
parent24ff97c6ee0a68fc208975b73fa5fa6dcf9c12ac (diff)
Only restart if SeaweedFS config's changed
-rw-r--r--playbooks.d/seaweedfs/playbook.bash15
1 files changed, 14 insertions, 1 deletions
diff --git a/playbooks.d/seaweedfs/playbook.bash b/playbooks.d/seaweedfs/playbook.bash
index 3eadac6..ad2dd3d 100644
--- a/playbooks.d/seaweedfs/playbook.bash
+++ b/playbooks.d/seaweedfs/playbook.bash
@@ -70,13 +70,26 @@ playbook_add() {
}
playbook_sync() {
+ local buffer
+ local conf
+
+ buffer="$(tmpfile)"
+ conf="$(config "fs.etcdir")/seaweedfs/server.conf"
+
# Generate config file
file_template "server.conf" \
"datadir=/var/lib/seaweedfs" \
"ip=$(config "vpn-tinc.ipv4")" \
"volume_size=1024" \
"reserved_space=10GiB" \
- > "$(config "fs.etcdir")/seaweedfs/server.conf"
+ > "$buffer"
+
+ if diff -q "$buffer" "$conf"
+ then
+ return
+ fi
+
+ mv -- "$buffer" "$conf"
[[ "$BASHTARD_ACTION" == "add" ]] && return