-
Notifications
You must be signed in to change notification settings - Fork 0
/
pnfs_dropbox_nontarfile.sh
executable file
·93 lines (71 loc) · 1.78 KB
/
pnfs_dropbox_nontarfile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Test script to untar $INPUT_TAR_FILE and list its contents
# To be used with --tar_file_name directives
function usage {
EXITCODE=$1
if [-z ${EXITCODE+x} ];
then
EXITCODE=0
fi
echo "Usage FILL THIS IN"
echo "-e <experiment> Which experiment's scratch area to write test file to"
echo "--testtar <tarball_name> What name of tarball we should be looking for"
echo "--secondtesttar <tarball_name> In case of multiple tarfiles, name of second dir"
echo "-h|--help Print this message and exit"
exit $EXITCODE
}
# Begin main
echo "Starting run now"
# Parse args
while (( "$#" )); do
case "$1" in
-e)
shift
EXPERIMENT=$1
shift
;;
-h|--help)
usage
;;
*)
echo "Error: unsupported flag $1" >&2
usage 1
;;
esac
done
# Checks
# echo "${INPUT_TAR_FILE?INPUT_TAR_FILE not set}"
# Defaults
# Assume nova if no expt given
if [[ -z ${EXPERIMENT+x} ]];
then
EXPERIMENT=nova
fi
SCRATCHDIR="/pnfs/${EXPERIMENT}/scratch/users/sbhat"
. /cvmfs/fermilab.opensciencegrid.org/products/common/etc/setups.sh
setup ifdhc
set -e
# Read file
echo "The dropbox file should live in \$CONDOR_DIR_INPUT"
if [[ -n ${CONDOR_DIR_INPUT+x} ]];
then
echo "Show contents of \$CONDOR_DIR_INPUT and any subdirectories:"
ls -Rl ${CONDOR_DIR_INPUT}
echo ""
echo "Show contents of any files in \$CONDOR_DIR_INPUT"
for FILE in `ls -1 ${CONDOR_DIR_INPUT}`
do
cat ${CONDOR_DIR_INPUT}/${FILE}
done
echo ""
fi
echo "Creating a new file to copy out"
DATE=`date +%s`
FILENAME="outfile_${DATE}"
ls -Rl ${_CONDOR_JOB_IWD} > ${_CONDOR_JOB_IWD}/${FILENAME}
DESTPATH=${SCRATCHDIR}/${FILENAME}
echo "Copying file out to $DESTPATH"
ifdh cp ${_CONDOR_JOB_IWD}/${FILENAME} $DESTPATH
echo "Copy Successful. Going to sleep."
sleep 300
exit 0