Skip to content

User Info & Stats

Account Status / Quota MOTD

A cron job on the server writes a .userinfo file into every SLURM user's home directory, using squota and sshadow to show the group's disk quota and the user's expiration date. This has to run on the server, not the login node — the login node is connected over NFS and doesn't have access to the quota information directly.

First, create the script:

sudo nano /root/update-user-info.sh
/root/update-user-info.sh
#!/bin/bash
# /root/update-user-info.sh

source /etc/slurm-powerautomate/credentials

for HOME_DIR in /raid_storage/SLURM/home/slurm_*; do
    user=$(basename "$HOME_DIR")

    # Get quota and expiry
    QUOTA=$(sudo squota $user 2>/dev/null)
    EXPIRY=$(echo "$LDAP_ADMIN_PASSWORD" | sudo sshadow $user status 2>/dev/null)

    # Write to user's home
    cat > "$HOME_DIR/.userinfo" << EOF
=== Account Status ===
$EXPIRY

=== Disk Quota ===
$QUOTA

Last updated: $(date '+%Y-%m-%d %H:%M')
EOF

    chmod 644 "$HOME_DIR/.userinfo"
done

Then schedule it with cron:

sudo crontab -e

Run it every 30 hours:

0 */30 * * * /root/update-user-info.sh

Showing It at Login

On the login node, create a profile script that displays the details on SSH login:

sudo nano /etc/profile.d/userinfo.sh
/etc/profile.d/userinfo.sh
#!/bin/bash
printf "\n"
[ -f "$HOME/.userinfo" ] && cat "$HOME/.userinfo"

To make the login banner cleaner, some default MOTD scripts are also disabled:

sudo chmod -x /etc/update-motd.d/50-motd-news
sudo chmod -x /etc/update-motd.d/90-updates-available
sudo chmod -x /etc/update-motd.d/91-release-upgrade

Exporting Full Job History

To export the complete job accounting history:

sacct --allusers --starttime=2025-02-30 --format=JobID,JobName,User,Account,Partition,QOS,State,ExitCode,Submit,Start,End,Elapsed,AllocCPUS,AllocTRES,ReqTRES,NodeList -X --parsable > slurm_complete_history.txt