#!/usr/bin/env bash # UKRRS: create one account lane = cgroup slice + matching user-slice drop-in. # usage: mkacct.sh [mem_high] [mem_max] [allowed_cpus] [tier] # # tier=agent (default): CPUWeight=75, pinned to a CPU pool — the 9 PMO/worker # lanes. interim rec: 3G 4.5G 0-5 post-upgrade: 10G 12G 0-15 # tier=human: CPUWeight=600, NO cpu restriction, generous memory — the two # human interactive accounts (KDE/CAD/EDA/video via xrdp live in these). # interim rec: 12G 16G all post-upgrade: 32G 40G all # # Examples (uids verified 2026-08-31): # sudo RUN=1 ./mkacct.sh reachableceo 1001 12G 16G all human # sudo RUN=1 ./mkacct.sh reachableceo-offstage 1010 12G 16G all human # sudo RUN=1 ./mkacct.sh TSGBOD 3G 4.5G 0-5 agent # # RUN=1 installs (needs root); default prints the plan + snippets only. set -euo pipefail acct=${1:?account}; uid=${2:?uid} high=${3:-3G}; max=${4:-4.5G}; cpus=${5:-0-5}; tier=${6:-agent} RUN=${RUN:-0} case "$tier" in human) weight=600; cpuline="" ;; agent) weight=75; cpuline="AllowedCPUs=$cpus" ;; *) echo "tier must be human or agent" >&2; exit 2 ;; esac slice="/etc/systemd/system/ukrrs-acct-$acct.slice" userdrop="/etc/systemd/system/user-$uid.slice.d/50-ukrrs.conf" cat <&2; exit 1; } cat > "$slice" < "$userdrop" <