-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Derived from https://github.com/Supervisor/supervisor/issues/553#issuecomment-1353523182 | ||
|
||
# Get prefix from SUPERVISOR_PROCESS_NAME environment variable | ||
printf -v PREFIX "%-10.10s" "${SUPERVISOR_PROCESS_NAME}" | ||
|
||
# Prefix stdout and stderr | ||
exec 1> >( perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&1) | ||
exec 2> >( perl -ne '$| = 1; print "'"${PREFIX}"' | $_"' >&2) | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit -o nounset -o pipefail | ||
|
||
function update_passwd_group() { | ||
cat /etc/passwd.system /etc/runtime_config/passwd > /etc/passwd | ||
cat /etc/group.system /etc/runtime_config/group > /etc/group | ||
} | ||
|
||
function watch_runtime_config() { | ||
inotifywait --monitor --recursive --event create,delete,modify,attrib,move /etc/runtime_config | while read FILE; do | ||
echo "Detected changes in /etc/runtime_config/. Updating /etc/passwd and /etc/group after a short delay." | ||
# approximate debounce | ||
timeout 3 cat > /dev/null || true | ||
echo "Updating /etc/passwd and /etc/group" | ||
update_passwd_group | ||
done | ||
} | ||
|
||
function watch_slurm_config() { | ||
inotifywait --monitor --recursive --event create,delete,modify,attrib,move /etc/slurm | while read FILE; do | ||
echo "Detected changes in /etc/slurm/. Running scontrol reconfigure after a short delay." | ||
# approximate debounce | ||
timeout 3 cat > /dev/null || true | ||
echo "Running scontrol reconfigure" | ||
/opt/slurm/bin/scontrol reconfigure | ||
done | ||
} | ||
|
||
# Inital update | ||
update_passwd_group | ||
|
||
# Continuously watch for changes | ||
watch_runtime_config & | ||
watch_slurm_config & | ||
|
||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[supervisord] | ||
nodaemon=true | ||
user=root | ||
logfile=/var/log/supervisor/supervisord.log | ||
|
||
[unix_http_server] | ||
file=/var/run/supervisor.sock | ||
|
||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock | ||
|
||
[program:munge] | ||
command=/opt/prefix-output.sh /usr/bin/bash -c 'if [ -s "%(ENV_MUNGE_KEY_IMPORT_PATH)s" ]; then cp "%(ENV_MUNGE_KEY_IMPORT_PATH)s" /etc/munge/munge.key; fi; /usr/sbin/munged --foreground %(ENV_MUNGED_ARGS)s' | ||
autostart=true | ||
autorestart=true | ||
user=munge | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
priority=100 | ||
|
||
[program:slurmctld] | ||
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmctld -D %(ENV_SLURMCTLD_ARGS)s | ||
autostart=true | ||
autorestart=true | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
priority=150 | ||
|
||
[program:runtime_agent] | ||
command=/opt/prefix-output.sh /opt/runtime-agent.sh | ||
autostart=true | ||
autorestart=true | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
priority=200 |