Skip to content
Snippets Groups Projects
Commit 7c8ab2fe authored by Jupiter Hu's avatar Jupiter Hu
Browse files

add slurm provision

parent 95c42769
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
CVL_HOME="/cvl/home"
user_list=($(getent passwd | cut -d ":" -f1))
log_file="/root/slurm.log"
for user in ${user_list[*]}; do
uid=$(id -u ${user})
gid=$(id -g ${user})
user_home=${CVL_HOME}/${user}
if [ ! -d ${user_home} ]; then
mkdir -p ${user_home}
cp -r /etc/skel/* ${user_home}
chown -R ${uid}:${gid} ${user_home}
chmod 700 ${user_home}
account={{ projectname }}
cluster={{ clustername }}
find=$(sacctmgr list cluster ${cluster} | grep ${cluster})
if [ -z "${find}" ]; then
su slurm -c "sacctmgr -i add cluster ${cluster}" || { echo "error to create cluster ${cluster}" >> ${log_file} && exit 1; }
fi
find=$(sacctmgr list account ${account} | grep ${account})
if [ -z "${find}" ]; then
su slurm -c "sacctmgr -i add account ${account} Description=CVL Organization=monash cluster=${cluster}" || { echo "error to create account ${account}" >> ${log_file} && exit 1; }
fi
find=$(sacctmgr list user ${username} | grep ${username})
if [ -z "${find}" ]; then
su slurm -c "sacctmgr -i add user ${username} account=${account} cluster=${cluster}" || { echo "error to create user ${username}" >> ${log_file} && exit 1; }
fi
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment