#!/bin/bash #-------------------------------- # Sample Batch Processing File # Jimmy Dias (dias@biac.duke.edu) # # CVS ID and Authorship # $Id: batch_sample,v 1.4 2004/02/17 17:17:35 dias Exp $ #-------------------------------- # For more help on Bash scripting, see # http://www.tldp.org/LDP/abs/html/ # Set variables here. Make sure there is no space before or after the # "=' sign. # For example, RUNGLOB = run* would NOT work but RUNGLOB=run* would. RUNGLOB=run004* ANATGLOB=series002 # This is the debug level for all scripts being run. The higher the number # the more verbose the output. Numbers 1-10 are generally used. DEBUG=5 # EXPID=BIRN.02 # Added 02/17/04 USERNAME=anderson ANATDIR=~/net/nernst/data1/BIRN.02/Data/Anat/20040120_42710_jd FUNCDIR=~/net/nernst/data1/BIRN.02/Data/Func/20040120_42710_jd CONFFILE=~/BIRN.02/birn.conf # If you would like to use the default global configuration file, uncomment # the following line and comment out the above line #CONFFILE=/etc/SPM99_procd.conf # Check if directory exists and is writable if [ ! -d "/data/users/$USERNAME" ] then echo "/data/users/$USERNAME does not exist."; echo "Please contact Jimmy Dias to set up a temporary data directory."; fi # Use Process ID number as temporary directory TEMPDIR=/data/users/$USERNAME/tmp$$ echo "creating $TEMPDIR" if ! mkdir $TEMPDIR then echo "make directory failed. You do not have permission for $TEMPDIR" exit $? fi echo "copying directories to local" time dircopy -D $DEBUG "$ANATDIR/$ANATGLOB" $TEMPDIR time dircopy -D $DEBUG "$FUNCDIR/$RUNGLOB" $TEMPDIR echo "changing to local directory" cd $TEMPDIR echo "running tralign" time tralign -D $DEBUG -c $CONFFILE -s -r "$RUNGLOB" echo "copying tralign results back" time dircopy -D $DEBUG "a$RUNGLOB" $FUNCDIR echo "running motioncorrect" time motioncorrect -D $DEBUG -c $CONFFILE -s -r "a$RUNGLOB" echo "copying motion correction results back" time dircopy -D $DEBUG "ra$RUNGLOB" $FUNCDIR echo "running coreg_normalize" time coreg_normalize -D $DEBUG -c $CONFFILE -s -r "ra$RUNGLOB" -a "$ANATGLOB" echo "copying coreg_normalize results back" time dircopy -D $DEBUG "ncra$RUNGLOB" $FUNCDIR time dircopy -D $DEBUG "nc$ANATGLOB" $ANATDIR echo "running smooth" time smooth -D $DEBUG -c $CONFFILE -s -r "ncra$RUNGLOB" echo "copying smooth results back" time dircopy -D $DEBUG "sncra$RUNGLOB" $FUNCDIR echo "cleaning and removing temporary directory" rm -rf $TEMPDIR echo "processing script done" exit $? # # $Log: batch_sample,v $ # Revision 1.4 2004/02/17 17:17:35 dias # removed use of EXPID for temporary directory and used username instead # # Revision 1.3 2004/01/30 15:28:40 dias # added some useful documentation # # Revision 1.2 2004/01/29 20:06:38 dias # added tmp to temp and check for mkdir # # Revision 1.1 2004/01/29 18:36:44 dias # imported source # # TODO: # 1) use epoch time for temporary directory to ensure uniqueness