-
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.
Merge pull request #7 from ualberta-rcg/main
Update entrypoint.sh
- Loading branch information
Showing
1 changed file
with
23 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# Export default values if not already set | ||
export AUTH_TYPE=${AUTH_TYPE:-auth/munge} | ||
export DBD_HOST=${DBD_HOST:-localhost} | ||
export DBD_PORT=${DBD_PORT:-6819} | ||
export STORAGE_TYPE=${STORAGE_TYPE:-accounting_storage/mysql} | ||
export STORAGE_HOST=${STORAGE_HOST:-localhost} | ||
export STORAGE_PORT=${STORAGE_PORT:-3306} | ||
export STORAGE_USER=${STORAGE_USER:-slurm} | ||
export STORAGE_PASS=${STORAGE_PASS:-password} | ||
export STORAGE_LOC=${STORAGE_LOC:-slurm_acct_db} | ||
export LOG_FILE=${LOG_FILE:-/var/log/slurm/slurmdbd.log} | ||
export PID_FILE=${PID_FILE:-/var/run/slurmdbd.pid} | ||
export SLURM_USER=${SLURM_USER:-slurm} | ||
export DEBUG_LEVEL=${DEBUG_LEVEL:-debug} | ||
|
||
# Redirect logs to stdout and stderr for Kubernetes | ||
if [ -z "${LOG_FILE}" ] || [ "${LOG_FILE}" = "/var/log/slurm/slurm-dbd.log" ]; then | ||
export LOG_FILE=/dev/stdout | ||
fi | ||
|
||
# Replace variables in the template and write to /etc/slurm/slurmdbd.conf | ||
envsubst < /etc/slurm/slurmdbd.conf.template > /etc/slurm/slurmdbd.conf | ||
mkdir -p /var/log/slurm/ | ||
touch /var/log/slurm/slurm-dbd.log | ||
|
||
# Read and substitute the template | ||
while IFS= read -r line; do | ||
eval "echo \"$line\"" | ||
done < /etc/slurm/slurmdbd.conf.template > /etc/slurm/slurmdbd.conf | ||
|
||
chmod 600 /etc/slurm/slurmdbd.conf | ||
chmod 400 /etc/munge/munge.key | ||
chown munge:munge /etc/munge/munge.key | ||
chown slurm:slurm /etc/slurm/slurmdbd.conf | ||
|
||
chown slurm:slurm -R /var/log/slurm | ||
# Run slurmdbd | ||
exec slurmdbd "$@" |