changeset 0:ee7ea1c2d01a draft

You must edit the sender email in the perl script after installation!
author geert-vandeweyer
date Wed, 08 May 2013 04:44:35 -0400
parents
children 0b1cdae7ad5b
files sendmail.pl
diffstat 1 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sendmail.pl	Wed May 08 04:44:35 2013 -0400
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+# load modules
+use Getopt::Std;
+
+##########################
+# COMMAND LINE ARGUMENTS #
+##########################
+# u = (u)ser email from galaxy
+# s = subject
+# a = sample (a)nnotation
+# g = sample (g)ender
+# o = (o)utput file (simple text file)
+getopts('u:s:o:d:', \%opts);  # option are in %opts
+
+
+if (!exists($opts{'u'})) {
+	die('no email specified');
+}
+$email = $opts{'u'};
+
+if (exists($opts{'s'}) && $opts{'s'} ne '') {
+	$subject = $opts{'s'};
+}
+else {
+	$subject = "Galaxy Workflow or Job Finished\n";
+}
+
+# first compose message.
+open OUT, ">mail.txt";
+print OUT "to: $email\n";
+print OUT "subject: $subject\n";
+## EDIT THE FROM EMAIL !!!
+print OUT "from: ADMIN\@Your.Galaxy.org\n\n";
+print OUT "Your Workflow on the Biomina Galaxy instance is finished. \n\n";
+#print OUT "Access the results at : http://143.169.238.104/galaxy/\n";
+if (exists($opts{'d'})) {
+	my @files = split(/@@@/,$opts{'d'});
+	print OUT "\n\nThe following datasets needed to be available before sending this notice:\n";
+	foreach (@files) {
+		$_ =~ s/^\s+//;
+		if ($_ eq '') {
+			next;
+		}
+		print OUT " - $_\n";
+	}
+}
+print OUT "\n\nPlease clean up unneeded datafiles, including hidden files (select 'show hidden').\n";
+close OUT;
+system("sendmail $email < mail.txt");
+system("rm -f mail.txt");
+
+