-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-main.sh
executable file
·53 lines (44 loc) · 1.35 KB
/
run-main.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
#!/bin/bash
# data_snapshot=NULL
#
# for argument in "$@"
# do
# key=$( echo $argument | cut -f1 -d=)
# value=$(echo $argument | cut -f2 -d=)
#
# if [[ $key == *"--"* ]]; then
# v="${key/--/}"
# declare $v="${value}"
# fi
# done
#
# args=()
# args+=( '--data_snapshot' ${data_snapshot} )
##################################################
currentDIR=`pwd`
codeDIR=${currentDIR}/code
timeStamp=`date +"%Y-%m-%d.%H-%M-%S"`
outputDIR=${currentDIR//github/gittmp}/output.${timeStamp}
parentDIR=`dirname ${currentDIR}`
# dataDIR=${parentDIR}/000-data
dataDIR=000-data
if [ ! -d ${outputDIR} ]; then
mkdir -p ${outputDIR}
chmod -R ugo+w ${outputDIR}
fi
cp -r ${codeDIR} ${outputDIR}
cp $0 ${outputDIR}/code
##################################################
myRscript=${codeDIR}/main.R
stdoutFile=${outputDIR}/stdout.R.`basename ${myRscript} .R`
stderrFile=${outputDIR}/stderr.R.`basename ${myRscript} .R`
R --no-save --args ${dataDIR} ${codeDIR} ${outputDIR} < ${myRscript} > ${stdoutFile} 2> ${stderrFile}
##################################################
# if [[ "${OSTYPE}" =~ .*"linux".* ]]; then
# echo
# echo "giving newly created environment a name by adding symbolic link ..."
# echo
# ln -s ${outputDIR}/condaEnvGEE /opt/conda/envs/condaEnvGEE
# fi
##################################################
exit