    cat <<EOF
 @@ -148,16 +167,12 @@
  Usage: $command [options] <command>
-
+ 
  $command gzip *.img *.hdr
 -$command -q short.q gzip *.img *.hdr
  $command -a darwin regscript rawdata outputdir ...
-
+ 
    -T <minutes>          Estimated job length in minutes, used to auto-set queue name
 -  -q <queuename>        Possible values for <queuename> are "verylong.q", "long.q" 
 -                        and "short.q". See below for details
 -                        Default is "long.q".
 -  -a <arch-name>        Architecture [e.g., darwin or lx24-amd64]
 +  -a <arch-name>        Architecture [e.g., darwin (not Legion) or lx24-amd64]
-   -p <job-priority>     Lower priority [0:-1024] default = 0
+   -p <job-priority>     Lower priority [0:-1024] default = 0                 
 -  -M <email-address>    Who to email, default = `whoami`@fmrib.ox.ac.uk 
 +  -M <email-address>    Who to email, default = `whoami`@ucl.ac.uk 
    -j <jid>              Place a hold on this task until job jid has completed
    -t <filename>         Specify a task file of commands to execute in parallel
    -N <jobname>          Specify jobname as it will appear on queue
-@@ -165,25 +180,11 @@
+@@ -166,25 +181,11 @@
    -m <mailoptions>      Change the SGE mail options, see qsub for details
    -z <output>           If <output> image or file already exists, do nothing and exit
    -F                    Use flags embedded in scripts to set SGE queuing options

--- bin/fsl_sub-dist    2016-01-19 14:40:58.000000000 +0000
+++ bin/fsl_sub 2016-01-19 16:55:24.000000000 +0000
@@ -11,6 +11,8 @@
 #   Imaging of the Brain), Department of Clinical Neurology, Oxford
 #   University, Oxford, UK
 #
+#   Modified for use on UCL Legion OS upgrade - January 2015 by BAA  
+#   
 #
 #   LICENCE
 #
@@ -125,12 +127,27 @@
     else
        queue=verylong.q
     fi
-    queueCmd=" -q $queue " 
+
+    # No user queues on Legion
+    queueCmd="" 

     #echo "Estimated time was $1 mins: queue name is $queue"
 }

 ###########################################################################
+# 
+#   Convert FSL runtimne in minutes to h_rt=hrs:mins:secs for Legion

       queue=$2
+      echo "Queue must not be specified on Legion"
+      exit 127
       queueCmd=" -q $queue " 
       $QCONF -sq $queue >/dev/null 2>&1
       if [ $? -eq 1 ]; then
@@ -328,7 +332,7 @@
       JobName=$2;
       shift;;
     -R)
-      RAM="-l mem_free=${2}M"
+      RAM="-l mem=${2}M"
       shift;;
     -m)
       MailOpts=$2;
@@ -355,6 +359,7 @@
     -s)
       pe_string=$2;
       peName=`echo $pe_string | cut -d',' -f 1`
+      peName='smp'	# must be smp on legion
       peThreads=`echo $pe_string | cut -d',' -f 2`
       shift;;
   esac
@@ -451,7 +456,7 @@
 
 	if [ "x$tasks" = "x" ] ; then
 	    if [ $scriptmode -ne 1 ] ; then
-		sge_command="qsub -V -cwd -shell n -b y -r y $queueCmd $pe_options -M $mailto -N $JobName -m $MailOpts $LogOpts $sge_arch $RAM $sge_hold"
+		sge_command="qsub -V -cwd -shell n -b y -r y $queueCmd -l h_rt=$h_rt $pe_options -M $mailto -N $JobName -m $MailOpts $LogOpts $sge_arch $RAM $sge_hold"
 	    else
 		sge_command="qsub $LogOpts $sge_arch $sge_hold"
 	    fi
@@ -461,7 +466,7 @@
 	    fi
 	    exec $sge_command $@ | awk '{print $3}'
 	else
-	    sge_command="qsub -V -cwd $queueCmd $pe_options -M $mailto -N $JobName -m $MailOpts $LogOpts $sge_arch $RAM $sge_hold $sge_tasks"
+	    sge_command="qsub -V -cwd $queueCmd $pe_options -M $mailto -N $JobName -l h_rt=$h_rt -m $MailOpts $LogOpts $sge_arch $RAM $sge_hold $sge_tasks"
 	    if [ $verbose -eq 1 ] ; then 
 		echo sge_command: $sge_command >&2
 		echo control file: $taskfile >&2
