Skip to content

Instantly share code, notes, and snippets.

@bholt
Created March 12, 2015 03:28
Show Gist options
  • Save bholt/5d0d8638c0c1bb89a943 to your computer and use it in GitHub Desktop.
Save bholt/5d0d8638c0c1bb89a943 to your computer and use it in GitHub Desktop.
Ssh to first allocated node, passing Slurm environment variables through.
#!/bin/bash
# Usage: salloc <options> slurm-ssh
first=$(scontrol show hostname $SLURM_NODELIST | head -n1)
env=$(printenv | grep SLURM | sed -rn "s/=(.*)/='\1'/p" | paste -d' ' -s)
exec ssh $first -t "$env zsh"
@A2Amir
Copy link

A2Amir commented Apr 13, 2021

great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment