-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_one.sh
More file actions
executable file
·35 lines (30 loc) · 789 Bytes
/
Copy pathrun_one.sh
File metadata and controls
executable file
·35 lines (30 loc) · 789 Bytes
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
#!/bin/bash
# echo in runone
work_dir=`pwd`
# echo workdir is $work_dir
script_name=$(basename $1)
script_name=${script_name%%.*}
# echo script name is $script_name
if [ ! -e $script_name ]; then
mkdir $script_name
fi
cd $script_name
function complete() {
ls | grep -v "run.log" | xargs -I{} -P4 cp $work_dir/$script_name/{} $work_dir/result/
cp $work_dir/$script_name/run.log $work_dir/log/$script_name.log
cd $work_dir
exit 0
}
if [[ -f "run.log" ]]; then
run_log_end=$(tail -n 1 run.log)
if [[ ${run_log_end} =~ "Exit code: 0" ]]; then
echo Skip ${work_dir}/$1 since it already have results.
complete
exit 0
fi
fi
echo run ${work_dir}/$1
set -o pipefail
$work_dir/$1 2>&1 |tee run.log
echo "Exit code: $?" >> run.log
complete