#!/bin/bash # version 1.1, Apr 11, 2017 # from HPC testbed, copy to moo for distribution # scp /data/hpc/bin/mayday hjm@moo.nac.uci.edu:~/public_html/hpc REPORT="$HOME/.hpc-problem.tmp" RECIPS="hpc-support@uci.edu" #"hjmangalam@gmail.com" #"hpc-support@uci.edu" #"hmangala@uci.edu" clear while [ "xx$SUBJECT" == "xx" ] ; do echo -n " If this is the 1st time using this script, please read the HOWTO. before continuing. Intelligent terminals (konsole, gnome-terminal) will try to open a local browser if you click on the link; if not paste it into your own browser. http://goo.gl/oXgE4V The short version: you'll provide us a Subject: line below, then edit the auto-generated email that provides a lot of the info we need. At any point you can hit ^C to quit this process. Provide a brief (<50chars), descriptive Subject line and then hit [Enter]. [The script will take a few seconds to collect all the info we need.] ........50 chars ends about .....................| then [Enter] to continue " read SUBJECT SSZ=${#SUBJECT} if [[ "$SSZ" -lt "5" ]]; then echo "That's a pretty short subject; could you expand a bit, please??" SUBJECT="" fi #sleep 1; clear done echo "This may take a few secs to collect the info we need." sleep 1 PWD=`pwd` HOSTNAME=`hostname` UPTIME=`uptime` DATE=`date` LOADAVG=`cat /proc/loadavg` HOMEQUOTA=`quota $USER` groups=`id $USER` FREERAM=`free -g` MODULES=$(module list 2>&1 >/dev/null) QJOBS=`qstat -u $USER` NUMQJOBS=`echo $QJOBS | wc -c` # check out SGE jobs if [[ "$NUMQJOBS" -gt "1" ]]; then QJOBS=`qstat -u $USER | nc termbin.com 9999` else QJOBS="No Queued Jobs" fi # spew all the /dfs quotas on all filesystems to termbin # this is of course specific to BeeGFS filesystems. Others will need mods fsgroups=`id $USER | cut -f4 -d=| sed -e 's/[()0-9]//g'| sed -e 's/,/ /g'`; DFSQUOTAS=`(for FS in 1 2; do echo; echo; echo ===== [USER quota: $USER on /dfs${FS}] beegfs-ctl --cfgFile=/etc/beegfs/dfs${FS}.d/beegfs-client.conf --getquota --uid $USER; echo; echo; for OO in $fsgroups; do echo === [GROUP quota on /dfs${FS}]; beegfs-ctl --cfgFile=/etc/beegfs/dfs${FS}.d/beegfs-client.conf --getquota --gid $OO; echo ""; done done ) | nc termbin.com 9999` #echo $DFSQUOTAS #sleep 2 echo "User: $USER Groups: $groups HOME Quota: $HOMEQUOTA /dfs[12] Quotas (via termbin) $DFSQUOTAS Working Dir: $PWD Hostname: $HOSTNAME Uptime: $UPTIME Load Average: $LOADAVG RAM in use: $FREERAM Modules: $MODULES Queued Jobs: $QJOBS ========================================================= == Please leave the stanza above intact. == == Expand on your problem as much as you'd like below: == == This is freeform text; just type in as much extra == == info as you can and then exit this editor normally. == == ie, with 'nano', ^X, then 'y'; other editors differ == ========================================================= == What email address you'd prefer us to use, if not [$USER@uci.edu] == What OS are you connecting from? (Windows,Mac,Linux) == Are you connecting from ON-CAMPUS or from OFF-CAMPUS? If OFF, thru the campus VPN or via an on-campus machine? == What application are you using to connect with? (Terminal, putty, x2go, etc) == Overall Problem: == Specific scripts, programs or files causing the problem: (if the files aren't in this dir, please provide their FULL PATH) == EXACT Program execution line causing the problem or error: == EXACT Error Output: (Please paste in the error output if short, or provide a 'termbin' link to it as described in the HOWTO ) " > $REPORT sync OFFSET=`grep -n "What email address" $REPORT | cut -f1 -d:` let OFFSET+=1 export TERM=xterm if [[ "xx$EDITOR" = "xx" ]] ; then nano +${OFFSET} $REPORT; else $EDITOR +${OFFSET} $REPORT fi LOOP=1 while [ "$LOOP" == "1" ]; do clear echo " OK, ALMOST DONE! To SEND this email to HPC-Support, hit [S, then Enter]. To RE-EDIT your 'Problem Report', press [Enter] alone. To kill the author of this script, take a number. Your current 'Bug Report File' is still in [$REPORT]. where you can re-edit it and send it to us via regular email. or by typing this at the commandline: mail -s \"$SUBJECT\" < $REPORT $RECIPS " read SS; YN=`echo $SS | tr '[:upper:]' '[:lower:]'` if [[ "$YN" =~ "s" ]]; then mail -r ${USER}@uci.edu -c ${USER}@uci.edu -s "$SUBJECT" < $REPORT $RECIPS echo " Thanks for sending us this report. We should get back to you within an hour usually; if it's the evening or weekends it will be longer. If the cluster is on fire .. well, you wouldn't be able to use this script. " exit LOOP=0 else $EDITOR +15 $REPORT sync fi done