uabrc / devops-docs

https://docs.rc.uab.edu/devops-docs/
Apache License 2.0
1 stars 5 forks source link

Terminal messaging #26

Open wwarriner opened 1 year ago

wwarriner commented 1 year ago

Proposal for a script to message researchers with an active terminal. Use like send_message wwarr matlab or send_message wwarr.

#!/bin/bash

user="$1"
app="$2"

if [ -z "$app" ]; then
    app_msg=", including $app".
else
    app_msg="."
fi

read -r -d '' message <<-EOM
Please run research software in a job context instead of on the login node$app_msg
For more information on jobs, please visit our documentation at
    https://docs.rc.uab.edu/cheaha/slurm/submitting_jobs/#common-slurm-terminology
If you need assistance, please email us at support@listserv.uab.edu.
EOM

for term in $(w "$user" | grep "$user" | awk '{print $2}'); do
echo "$user :: $term"
echo "$message" | write "$user" "$term";
done;