comparison export_local_file.sh @ 0:c772c8912663

Uploaded
author david-hoover
date Tue, 28 Feb 2012 12:36:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c772c8912663
1 ###
2 ### The shell script: export_local_file.sh
3 ###
4 ### The script basically copies a Galaxy dataset (param 1, dataset_NNNNN.dat)
5 ### to the destination file (param 2, {/data,/home}/filename
6 ###
7 #!/bin/sh
8
9 INPUT="$1"
10 DEST="$2"
11 EMAIL="$3"
12 OUTPUT="$4"
13 USER=`echo $EMAIL | sed -e 's#@.*##'`
14
15 if [ -z "$DEST" ]; then
16 echo "Usage: $0 [INPUT] [DEST]" >&2
17 exit 1
18 fi
19
20 # Filter any unwanted directories
21
22 if [[ `echo $DEST | grep -c ^/data/` -lt 1 ]] && [[ `echo $DEST | grep -c ^/home/` -lt 1 ]] ; then
23 echo "Error: \"$DEST\" is not allowed" >&2
24 exit 1
25 fi
26
27 # Do the deed
28
29 cpy $INPUT $DEST "$USER"
30 dataset=`basename $INPUT`
31 if [ $? != 0 ]; then
32 echo "Error: $USER failed to copy dataset $dataset to \"$DEST\"" >&2
33 exit 1
34 fi
35
36 echo "Dataset $dataset successfully exported to \"$DEST\"" >> $OUTPUT
37
38 exit 0
39
40 ###
41 ###
42 ###
43