Last active
May 1, 2018 17:45
-
-
Save kylebarron/1d629f5eb8a35df12d4b773cac11319f to your computer and use it in GitHub Desktop.
List jobs using >= 1GB of memory on remote servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# This depends on `smem`, a memory reporting tool, being available on the remote server | |
# The following two commands will put the smem executable in your current directory | |
# wget https://selenic.com/repo/smem/archive/tip.tar.gz | |
# tar -xzvf tip.tar.gz --wildcards "smem-*/smem" --strip-components 1 | |
# | |
# You then need to change `smem_path` to the path on the remote server of smem | |
smem_path="/disk/homedirs/barronk-dua51929/local/bin/smem" | |
ssh_cmd="$smem_path -s pss -r -t -k -c 'pid command pss' | sed -r '/K\s$/d'" | |
username=barronk-dua51929 | |
remote_check () { | |
output=$(ssh $username@age$1.nber.org -o LogLevel=Quiet -t $ssh_cmd) | |
echo "$output" | tail -n 1 | grep -P '\dG' > /dev/null | |
rc=$? | |
if [[ "$rc" == 0 ]]; then | |
echo -e "Age $1:\n$output" | |
fi | |
} | |
for i in {1..7} {9..10} {13..14} {16..17}; do | |
remote_check $i & | |
done | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment