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
94
95
96
97
|
#!/bin/bash
#----------------------------------------------------------------------------------------------------
# set defaults
test_only="y"
use_lxbatch="n"
queue="1nd"
#----------------------------------------------------------------------------------------------------
function PrintUsage()
{
echo "USAGE: submit <options> [config]"
echo "OPTIONS:"
echo " -test prepare jobs but do not execute"
echo " -run prepare jobs and execute"
echo " -local execute jobs locally"
echo " -batch, -lxbatch submit jobs to LXBATCH"
echo " -submit abbreviation of -run and -batch"
echo " -queue <q> use LXBATCH queue <q>, implies -batch option"
}
#----------------------------------------------------------------------------------------------------
# load code
source "tb_code"
#----------------------------------------------------------------------------------------------------
# parse command line
while [ -n "$1" ]
do
case "$1" in
"-h" | "--help")
PrintUsage
exit 0
;;
"-test")
test_only="y"
;;
"-run")
test_only="n"
;;
"-local")
use_lxbatch="n"
;;
"-batch" | "-lxbatch")
use_lxbatch="y"
;;
"-queue")
shift
queue="$1"
use_lxbatch="y"
;;
"-submit")
test_only="n"
use_lxbatch="y"
;;
-*)
echo "ERROR: unknown option '$1'."
PrintUsage
exit 1
;;
*)
if [ -n "$input_config" ]
then
echo "ERROR: only one config can be used at at time."
exit 1
fi
input_config="$1"
;;
esac
shift
done
#----------------------------------------------------------------------------------------------------
# source config
if [ ! -f "$input_config" ]
then
echo "ERROR: can't read config file '$input_config'."
PrintUsage
exit 1
fi
source "$input_config"
|