Skip to content

Instantly share code, notes, and snippets.

@icaoberg
Last active January 22, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icaoberg/7f315616d6aac1f17520 to your computer and use it in GitHub Desktop.
Save icaoberg/7f315616d6aac1f17520 to your computer and use it in GitHub Desktop.
Sample script that performs a daily task that I will add to my crontab #slurm
#!/bin/bash
## the next line selects the partition/queue
#SBATCH -p short1
## the next line selects the number of nodes
#SBATCH -N 1
## the next line selects the number of CPUs
#SBATCH -n 1
## the next line selects the memory size
#SBATCH --mem=2G
## the next line selects the walltime
#SBATCH -t 12:00
#icaoberg 10/19/2015
#This script downloads a png graph that displays the
#Lane/CBD cluster daily load and then mails it to the members in variable EMAIL
DATE=`date "+%m-%d-%Y_%H:%M:%S"`
if [ "$#" -ne 1 ]; then
EMAIL="icaoberg@cmu.edu"
else
EMAIL=$1
fi
SUBJECT="Lane Cluster Daily Load Graph"
MESSAGE="This is an automated report generated by icaoberg@lanec1.compbio.cs.cmu.edu using data extracted from Ganglia."
URL='http://lanec1.compbio.cs.cmu.edu/ganglia/graph.php?r=day&z=xlarge&c=Lane&m=load_one&s=by+name&mc=2&g=load_report'
FILENAME="$DATE""_daily_report.png"
wget "$URL" -O "$FILENAME"
echo "$MESSAGE" | mail -s "$SUBJECT" -a "$FILENAME" $EMAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment