18 lines
650 B
Bash
Executable File
18 lines
650 B
Bash
Executable File
#!/bin/sh
|
|
# Render the profile's slurm.conf and, when it differs from the local one,
|
|
# install it and restart slurmctld. Runs from rollcall-controller-sync.timer.
|
|
set -eu
|
|
PROFILE=${PROFILE:-compute}
|
|
CONF=/etc/slurm/slurm.conf
|
|
new=$(mktemp)
|
|
trap 'rm -f "$new"' EXIT
|
|
/usr/local/bin/rollcall render "$PROFILE" etc/slurm/slurm.conf > "$new" || exit 0
|
|
if [ -f "$CONF" ] && grep -v '^# rendered by rollcall' "$new" | cmp -s - "$(grep -v '^# rendered by rollcall' "$CONF" > "$new.old" && echo "$new.old")"; then
|
|
rm -f "$new.old"
|
|
exit 0
|
|
fi
|
|
rm -f "$new.old"
|
|
install -m 0644 "$new" "$CONF"
|
|
systemctl try-restart slurmctld.service
|
|
echo "slurm.conf updated"
|