I'm a beginner user on Ubuntu 20.04 LST. Down there where it is a script on python for slurm that I have been trying to work however it doesn't.
There is something wrong at three variables.
#! /bin/bash
ROOT_UID=0
#Run as root, of course. (this might not be necessary, because we have to run the script somehow with root anyway)
if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script"
exit "$E_NOTROOT"
fi
#test, arguments are down there for slurm.
if [ $# -eq 3 ]; then
slurmname=$1
accountname=$2
maxjobsnumbers=$3
# to create just a slurm user on the default account
sacctmgr create user -s "$slurmname" "$accountname"
# to setup job limit for a slurm user
sacctmgr -i modify user "$slurmname" set "$maxjobsnumbers"
# to show job limit
sacctmgr show ass
echo ""
echo "The user has been setuped on Slurm"
sacctmgr show user "$slurmname"
else
echo " this program needs 3 arguments you have given $# "
echo " you have to call the script $0 slurmname, accountname and maxjobsnumbers "
fi
exit 0
When i run the .sh file with the command, output is;
tonny (slurmname)
music (accountname)
1 (maxjobsnumbers)
root@hn:/home/sysadmin1/Desktop# ./adduser_slurm.sh tonny music 1
Need name of account to add user to.
Nothing new added.
Bad format on 1: End your option with an '=' sign
Cluster Account User Partition Share Priority
GrpJobs GrpTRES GrpSubmit GrpWall GrpTRESMins
MaxJobs MaxTRES MaxTRESPerNode MaxSubmit MaxWall
MaxTRESMins QOS Def QOS GrpTRESRunMin
---------- ---------- ---------- ---------- --------- ---------
- ------- ------------- --------- ----------- ------------- ----
--- ------------- -------------- --------- ----------- ---------
---- -------------------- --------- -------------
cluster root 1
normal
cluster root root 1
normal
cluster music 1
normal
cluster music cta1 1
3
normal
cluster music cta2 1
2
normal
The user has been setuped on Slurm
User Def Acct Admin
---------- ---------- ---------
No new user who has been added.
I mean, how I can create a new user, how I can add the new user on slurm account, and how I can setup maxjob limits for the new user with this script on slurm?