Skip to content

Instantly share code, notes, and snippets.

@araij

araij/build.sh Secret

Last active May 20, 2020 04:16
Show Gist options
  • Save araij/7fe6e14c31d08f69e5873e8cd7fa4fd0 to your computer and use it in GitHub Desktop.
Save araij/7fe6e14c31d08f69e5873e8cd7fa4fd0 to your computer and use it in GitHub Desktop.
Slurm 20.02.2 packaging script
#!/bin/bash
set -xe
#
# Download and unpack the tarball
#
wget https://download.schedmd.com/slurm/slurm-20.02.2.tar.bz2
tar xf slurm-20.02.2.tar.bz2
cd slurm-20.02.2/
#
# Copy CheckInstall files
#
cp ../*-pak .
#
# Install dependencies and CheckInstall
#
apt update
apt install -y --no-install-recommends \
build-essential \
libmunge-dev \
libmysqlclient-dev \
munge \
checkinstall
#
# Make Slurm
#
# We use /usr and /etc/slurm as 'prefix' and 'sysconfdir', respectively, to
# keep a consistency with other Debian packages.
#
./configure --prefix=/usr --sysconfdir=/etc/slurm
make -j$(( $(nproc) + 1 ))
#
# Copy configuration files to install directories
#
install -m 644 -D etc/slurm.conf.example etc/slurm/slurm.conf
install -m 644 -D etc/slurmdbd.conf.example etc/slurm/slurmdbd.conf
install -m 644 -D etc/cgroup.conf.example etc/slurm/cgroup.conf
install -m 644 -D etc/slurmd.service lib/systemd/system/slurmd.service
install -m 644 -D etc/slurmctld.service lib/systemd/system/slurmctld.service
install -m 644 -D etc/slurmdbd.service lib/systemd/system/slurmdbd.service
#
# Make and install the package
#
checkinstall \
--default \
--pakdir=.. \
--include=../include-list \
--requires=munge,libmunge2,libmysqlclient20
Simple Linux Utility for Resource Management
etc/slurm/slurm.conf
etc/slurm/slurmdbd.conf
etc/slurm/cgroup.conf
lib/systemd/system/slurmd.service
lib/systemd/system/slurmctld.service
lib/systemd/system/slurmdbd.service
#!/bin/bash
set -e
#
# Add a user for running Slurm
#
# We specify the UID of user 'slurm' because it must have the same UID across
# the cluster (https://slurm.schedmd.com/quickstart_admin.html).
# UID 64030 comes from Debian's Slurm package.
# (https://salsa.debian.org/hpc-team/slurm-wlm/blob/master/debian/slurm-wlm-basic-plugins.preinst)
#
if ! id -u slurm >/dev/null 2>&1; then
adduser --quiet --system --group --uid 64030 --no-create-home \
--home /nonexistent slurm
fi
#
# Make directories
#
install -g slurm -o slurm -d /var/lib/slurm
install -g slurm -o slurm -d /var/log/slurm
install -g slurm -o slurm -d /var/spool/slurm
#
# Enable Slurm daemons
#
systemctl enable slurmdbd
systemctl enable slurmd
systemctl enable slurmctld
#!/bin/bash
set -e
#
# Stop and disable daemons if they exist
#
if systemctl list-unit-files | grep -q slurmd; then
systemctl disable --now slurmd
fi
if systemctl list-unit-files | grep -q slurmctld; then
systemctl disable --now slurmctld
fi
if systemctl list-unit-files | grep -q slurmdbd; then
systemctl disable --now slurmdbd
fi
#!/bin/bash
set -e
#
# Stop and disable daemons if they exist
#
if systemctl list-unit-files | grep -q slurmd; then
systemctl disable --now slurmd
fi
if systemctl list-unit-files | grep -q slurmctld; then
systemctl disable --now slurmctld
fi
if systemctl list-unit-files | grep -q slurmdbd; then
systemctl disable --now slurmdbd
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment