#!/bin/bash RAINBOW_MAILFROM=${RAINBOW_MAILFROM:-rainbow@$(hostname -d)} send_email () { local rcptto=$1 shift local jobid=$1 shift local jobstate=$1 shift local subject="Rainbow job $jobstate: $jobid" body_template="${jobstate}_TEXT" printf "${!body_template}\n" $* | mail -s "$subject" -r $RAINBOW_MAILFROM "$rcptto" } PREPARED_TEXT="Dear, user! Your virtual machine submitted to the grid infrastructure has been successfully prepared and wanting for launch in local resource manager queue. Your sincerely, Rainbow helper service" READY_TEXT="Dear, user! Your virtual machine submitted to the grid infrastructure is now available. Please use the following credentials to log in: Address: %s Login: %s Password: %s Your sincerely, Rainbow helper service" FAILED_TEXT="Dear, user! Unfortunately, your virtual machine submitted to the grid infrastructure had failed :( Error message received: %s You can find more info reviewing job's stdout and stderr. Your sincerely, Rainbow helper service" FINISHED_TEXT="Dear, user! Your virtual machine submitted to the grid infrastructure execution cycle has finished. Your sincerely, Rainbow helper service"