Skip to content

Instantly share code, notes, and snippets.

@stevenjswanson
Created August 21, 2023 05:53
Show Gist options
  • Save stevenjswanson/0b3650a123fd93f54a1fd9b973ed2e65 to your computer and use it in GitHub Desktop.
Save stevenjswanson/0b3650a123fd93f54a1fd9b973ed2e65 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
if [ "$1" = "slurmdbd" ]
then
echo "---> Starting the MUNGE Authentication service (munged) ..."
service munge start
echo "---> Starting the Slurm Database Daemon (slurmdbd) ..."
{
. /etc/slurm/slurmdbd.conf
until echo "SELECT 1" | mysql -h $StorageHost -u$StorageUser -p$StoragePass 2>&1 > /dev/null
do
echo "-- Waiting for database to become active ..."
sleep 2
done
}
echo "-- Database is now active ..."
exec gosu slurm /usr/sbin/slurmdbd -Dvvv
fi
if [ "$1" = "slurmctld" ]
then
echo "---> Starting the MUNGE Authentication service (munged) ..."
service munge start
echo "---> Waiting for slurmdbd to become active before starting slurmctld ..."
until 2>/dev/null >/dev/tcp/slurmdbd/6819
do
echo "-- slurmdbd is not available. Sleeping ..."
sleep 2
done
echo "-- slurmdbd is now active ..."
echo "---> Starting the Slurm Controller Daemon (slurmctld) ..."
if /usr/sbin/slurmctld -V | grep -q '17.02' ; then
exec gosu slurm /usr/sbin/slurmctld -Dvvv
else
exec gosu slurm /usr/sbin/slurmctld -i -Dvvv
fi
fi
if [ "$1" = "slurmd" ]
then
echo "---> Starting the MUNGE Authentication service (munged) ..."
service munge start
echo "---> Waiting for slurmctld to become active before starting slurmd..."
until 2>/dev/null >/dev/tcp/slurmctld/6817
do
echo "-- slurmctld is not available. Sleeping ..."
sleep 2
done
echo "-- slurmctld is now active ..."
echo "---> Starting the Slurm Node Daemon (slurmd) ..."
# service slurmd start
# while true; do sleep 60;done
exec /usr/sbin/slurmd -Dvvv
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment